[Scummvm-cvs-logs] scummvm master -> 2eed6daf72468fdcf5ef0a0ab54871e7d3943ff6
lordhoto
lordhoto at gmail.com
Sun Mar 30 21:42:16 CEST 2014
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8638b29b89 SCUMM: Avoid potential issues casting invalid values to enum
2eed6daf72 Merge pull request #457 from fingolfin/clang-fixes
Commit: 8638b29b8933e1cee30c5bac8641278ba039a1f8
https://github.com/scummvm/scummvm/commit/8638b29b8933e1cee30c5bac8641278ba039a1f8
Author: Max Horn (max at quendi.de)
Date: 2014-03-30T19:48:08+02:00
Commit Message:
SCUMM: Avoid potential issues casting invalid values to enum
A compiler could in principle decide that a ResType enum can
never equal 0xFF or 0xFFFF, and thus incorrectly optimize
the ScummEngine::saveOrLoad code. So check the value
*before* casting it.
Changed paths:
engines/scumm/saveload.cpp
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index fc3c193..0aaff4c 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1242,7 +1242,9 @@ void ScummEngine::saveOrLoad(Serializer *s) {
}
s->saveUint16(0xFFFF); // End marker
} else {
- while ((int)(type = (ResType)s->loadUint16()) != 0xFFFF) {
+ uint16 tmp;
+ while ((tmp = s->loadUint16()) != 0xFFFF) {
+ type = (ResType)tmp;
while ((idx = s->loadUint16()) != 0xFFFF) {
assert(idx < _res->_types[type].size());
loadResource(s, type, idx);
@@ -1430,7 +1432,9 @@ void ScummEngine::saveOrLoad(Serializer *s) {
}
s->saveByte(0xFF);
} else {
- while ((int)(type = (ResType)s->loadByte()) != 0xFF) {
+ uint8 tmp;
+ while ((tmp = s->loadByte()) != 0xFF) {
+ type = (ResType)tmp;
idx = s->loadUint16();
_res->lock(type, idx);
}
Commit: 2eed6daf72468fdcf5ef0a0ab54871e7d3943ff6
https://github.com/scummvm/scummvm/commit/2eed6daf72468fdcf5ef0a0ab54871e7d3943ff6
Author: Johannes Schickel (lordhoto at gmail.com)
Date: 2014-03-30T21:41:53+02:00
Commit Message:
Merge pull request #457 from fingolfin/clang-fixes
SCUMM: Avoid potential issues casting invalid values to enum
Changed paths:
engines/scumm/saveload.cpp
More information about the Scummvm-git-logs
mailing list