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

COMMON: fix wrong size assignment in HashMap #1202

Merged
merged 1 commit into from May 25, 2018

Conversation

Projects
None yet
2 participants
@whiterandrek
Copy link
Member

whiterandrek commented May 24, 2018

Calling clear(1) makes the size of hashMap wrong
Examples:


Common::StringMap map;
Common::StringMap mapTest;

map.setVal("CabinOnGround1", "FALSE");
map.setVal("CabinOnGround3", "FALSE");
map.setVal("CabinOnGround2", "FALSE");
map.setVal("CabinOnGround5", "FALSE");
map.setVal("CabinOnGround4", "FALSE");
map.setVal("CabinOnGround6", "FALSE");
map.setVal("VSInSS", "FALSE");
map.setVal("SetSummer", "TRUE");
map.setVal("BNWelcomed", "TRUE");
map.setVal("SSEmptied", "TRUE");
map.setVal("IsWinter", "FALSE");

mapTest = map;
map.clear(1);

// 1 test
for (auto it = mapTest.begin(); it != mapTest.end(); ++it) {
		map.setVal(it->_key, it->_value); // endless execution
}

// 2 test
map = mapTest; // SIGSEGV 

@sev-

This comment has been minimized.

Copy link
Member

sev- commented May 25, 2018

Good catch, thank you!

@sev- sev- merged commit ac5f612 into scummvm:master May 25, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@whiterandrek whiterandrek deleted the whiterandrek:hash branch Jul 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.