[Commit] nickle ChangeLog,1.24,1.25 box.c,1.20,1.21

Keith Packard commit at keithp.com
Sat Apr 10 23:20:36 PDT 2004


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv12739

Modified Files:
	ChangeLog box.c 
Log Message:
2004-04-10  Keith Packard  <keithp at keithp.com>

	* box.c: (BoxRewrite):
	Ugh.  Array shrink causes problems with references to
	elements now outside the box boundaries.  "real" fix
	is hard, so here's a kludge to keep the interpreter
	from crashing and (perhaps) prevent the error
	from propagating through the application.


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- a/ChangeLog	11 Apr 2004 06:06:51 -0000	1.24
+++ b/ChangeLog	11 Apr 2004 06:20:34 -0000	1.25
@@ -1,5 +1,14 @@
 2004-04-10  Keith Packard  <keithp at keithp.com>
 
+	* box.c: (BoxRewrite):
+	Ugh.  Array shrink causes problems with references to
+	elements now outside the box boundaries.  "real" fix
+	is hard, so here's a kludge to keep the interpreter
+	from crashing and (perhaps) prevent the error
+	from propagating through the application.
+
+2004-04-10  Keith Packard  <keithp at keithp.com>
+
 	* array.c: (ArrayPrint), (ArrayResize):
 	* builtin-toplevel.c: (do_setdims), (do_setdim):
 	* builtin.c: (BuiltinType):

Index: box.c
===================================================================
RCS file: /local/src/CVS/nickle/box.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- a/box.c	27 Feb 2004 03:50:15 -0000	1.20
+++ b/box.c	11 Apr 2004 06:20:34 -0000	1.21
@@ -116,6 +116,23 @@
 	e = chunk * r->newstride + off;
 	box = r->new;
     }
+    /*
+     * XXX oops.  References to previously available storage
+     * should do something sensible instead of cratering.
+     * The desired semantic is for them to persist, pointing
+     * to whatever storage was there before the underlying object
+     * was resized.  But, that's "hard".  This check will
+     * at least prevent a seg fault.
+     */
+    if (e >= box->nvalues)
+    {
+	RaiseStandardException (exception_invalid_array_bounds,
+				"Rewriting reference beyond box bounds",
+				1, NewInt (e));
+	e = 0;
+	box = NewBox (True, False, 1, typePrim[rep_void]);
+	BoxValueSet (box, 0, 0);
+    }
     *ep = e;
     return box;
 }




More information about the Commit mailing list