--- sub.c.orig
+++ sub.c	Thu Nov  7 23:15:06 2002
@@ -139,7 +139,13 @@
     PMC * pad_pmc = pmc_new(interp, enum_class_Scratchpad);
     pad_pmc->cache.int_val = 0;
 
-    if ((base && depth > base->cache.int_val) || (!base && depth != 0)) {
+    if (base && depth < 0) {
+        depth = base->cache.int_val + depth + 1;
+    }
+
+    if ((depth < 0)
+        || (base && depth > base->cache.int_val) 
+        || (!base && depth != 0)) {
         internal_exception(-1, "-scratch_pad: too deep\n");
         return NULL;
     }


Reply via email to