mamedev / mame

MAME
https://www.mamedev.org/
Other
7.76k stars 1.95k forks source link

drivenum.cpp: fix undefined behavior in find_approximate_matches #12441

Closed SpecLad closed 3 weeks ago

SpecLad commented 4 weeks ago

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.