Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nall: always pass by reference to make_string() #328

Conversation

Screwtapello
Copy link
Contributor

Many specializations of stringify store a reference to the wrapped value. Therefore, passing arguments to make_string() by value can be disastrous if the compiler does not perform copy elision and stringify stores a reference to a variable that goes out of scope when make_string() returns.

Cherry-picked from ares commit 3d826f5b266027529f0c12211c744a23bbe25a56.

Because bsnes was missing this fix, my first attempt at preventing Bishoujo Senshi Sailor Moon SuperS - Fuwafuwa Panic from being detected as a Sufami Turbo base cartridge was caused a crash. Hat tip to SuperMikeMan100 on Discord for pointing it out.

Many specializations of stringify store a reference to the wrapped
value. Therefore, passing arguments to make_string() by value can be
disastrous if the compiler does not perform copy elision and stringify
stores a reference to a variable that goes out of scope when
make_string() returns.

Cherry-picked from ares commit 3d826f5b266027529f0c12211c744a23bbe25a56.
@Screwtapello Screwtapello merged commit 9fbbea2 into bsnes-emu:master Sep 5, 2024
4 of 5 checks passed
@Screwtapello Screwtapello deleted the nall-pass-by-reference-to-make_string branch September 5, 2024 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants