Object.st
changeset 18422 d328420eef12
parent 18404 ae9230dde5ca
child 18426 618b38afd88b
child 18440 dc5cde224664
--- a/Object.st	Fri May 29 13:38:19 2015 +0200
+++ b/Object.st	Sun May 31 11:23:08 2015 +0200
@@ -1556,7 +1556,11 @@
 	}
 	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
 	if ((idx >= 0) && (idx < ninstvars)) {
-	    RETURN ( __InstPtr(self)->i_instvars[idx] );
+	    // do not trust the ninstvars slot - verify
+	    if ((__OBJS2BYTES__(ninstvars) + OHDR_SIZE) <= __qSize(self)) {
+		RETURN ( __InstPtr(self)->i_instvars[idx] );
+	    }
+	    console_printf("[VM] warning: bad ninsts in class\n");
 	}
     }
 #endif /* not SCHTEAM */
@@ -1592,9 +1596,13 @@
 	    }
 	}
 	if ((idx >= 0) && (idx < ninstvars)) {
-	    __InstPtr(self)->i_instvars[idx] = value;
-	    __STORE(self, value);
-	    RETURN ( value );
+	    // do not trust the ninstvars slot - verify
+	    if ((__OBJS2BYTES__(ninstvars) + OHDR_SIZE) <= __qSize(self)) {
+		__InstPtr(self)->i_instvars[idx] = value;
+		__STORE(self, value);
+		RETURN ( value );
+	    }
+	    console_printf("[VM] warning: bad ninsts in class\n");
 	}
     }
 #endif /* not SCHTEAM */
@@ -10277,11 +10285,11 @@
 !Object class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.807 2015-05-25 12:02:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.808 2015-05-31 09:23:08 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.807 2015-05-25 12:02:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.808 2015-05-31 09:23:08 cg Exp $'
 !
 
 version_SVN