[Scummvm-cvs-logs] SF.net SVN: scummvm:[46673] scummvm/trunk/engines/sci/engine/vm.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Mon Dec 28 15:22:11 CET 2009
Revision: 46673
http://scummvm.svn.sourceforge.net/scummvm/?rev=46673&view=rev
Author: thebluegr
Date: 2009-12-28 14:22:11 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
Added a workaround for an off-by-one invalid species access bug in the LSL2 demo
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/vm.cpp
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2009-12-28 13:47:17 UTC (rev 46672)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2009-12-28 14:22:11 UTC (rev 46673)
@@ -1591,11 +1591,17 @@
int species;
species = scr->getHeap(addr.offset - SCRIPT_OBJECT_MAGIC_OFFSET + SCRIPT_SPECIES_OFFSET);
if (species < 0 || species >= (int)segMan->_classtable.size()) {
- warning("Invalid species %d(0x%x) not in interval "
- "[0,%d) while instantiating script %d\n",
- species, species, segMan->_classtable.size(),
- script_nr);
- return 0;
+ if (species == (int)segMan->_classtable.size()) {
+ // Happens in the LSL2 demo
+ warning("Applying workaround for an off-by-one invalid species access");
+ segMan->_classtable.resize(segMan->_classtable.size() + 1);
+ } else {
+ warning("Invalid species %d(0x%x) not in interval "
+ "[0,%d) while instantiating script %d\n",
+ species, species, segMan->_classtable.size(),
+ script_nr);
+ return 0;
+ }
}
segMan->_classtable[species].reg = addr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list