SCI: kStrAt / dont do call, when offset exceeds maxSize. fixes crash in kq5

svn-id: r45530
This commit is contained in:
Martin Kiewitz 2009-10-30 10:06:35 +00:00
parent 4009f6836b
commit 0c2ab71829

View File

@ -309,8 +309,11 @@ reg_t kStrAt(EngineState *s, int argc, reg_t *argv) {
newvalue = argv[2].toSint16();
if (dest_r.isRaw) {
// FIXME: in kq5 this here gets called with offset = 0xFFFF, we should implement maxSize check in here
// i dont know the exact behaviour, so i dont know how to do this correctly
// in kq5 this here gets called with offset 0xFFFF
if ((int)offset > dest_r.maxSize) {
warning("kStrAt offset %X exceeds maxSize", offset);
return s->r_acc;
}
value = dest_r.raw[offset];
if (argc > 2) /* Request to modify this char */
dest_r.raw[offset] = newvalue;