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

drivenum.cpp: fix undefined behavior in find_approximate_matches #12441

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

SpecLad
Copy link
Contributor

@SpecLad SpecLad commented Jun 4, 2024

If it points to the last element of penalty, the resize call invalidates it, and the subsequent call to emplace is undefined. This causes a crash in MSVC debug mode.

Fix it by resizing after emplacing.

If `it` points to the last element of `penalty`, the `resize` call invalidates
it, and the subsequent call to `emplace` is undefined. This causes a crash
in MSVC debug mode.

Fix it by resizing _after_ emplacing.
@rb6502 rb6502 merged commit af79954 into mamedev:master Jun 6, 2024
5 checks passed
@SpecLad SpecLad deleted the drivenum-undefined branch June 6, 2024 17:46
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.

None yet

2 participants