@@ -151,6 +151,7 @@ def test_inst_one_pop(self):
151
151
value = stack_pointer[-1];
152
152
spam();
153
153
stack_pointer += -1;
154
+ assert(WITHIN_STACK_BOUNDS());
154
155
DISPATCH();
155
156
}
156
157
"""
@@ -171,6 +172,7 @@ def test_inst_one_push(self):
171
172
spam();
172
173
stack_pointer[0] = res;
173
174
stack_pointer += 1;
175
+ assert(WITHIN_STACK_BOUNDS());
174
176
DISPATCH();
175
177
}
176
178
"""
@@ -216,6 +218,7 @@ def test_binary_op(self):
216
218
spam();
217
219
stack_pointer[-2] = res;
218
220
stack_pointer += -1;
221
+ assert(WITHIN_STACK_BOUNDS());
219
222
DISPATCH();
220
223
}
221
224
"""
@@ -337,6 +340,7 @@ def test_error_if_pop(self):
337
340
if (cond) goto pop_2_label;
338
341
stack_pointer[-2] = res;
339
342
stack_pointer += -1;
343
+ assert(WITHIN_STACK_BOUNDS());
340
344
DISPATCH();
341
345
}
342
346
"""
@@ -360,6 +364,7 @@ def test_cache_effect(self):
360
364
uint32_t extra = read_u32(&this_instr[2].cache);
361
365
(void)extra;
362
366
stack_pointer += -1;
367
+ assert(WITHIN_STACK_BOUNDS());
363
368
DISPATCH();
364
369
}
365
370
"""
@@ -425,6 +430,7 @@ def test_macro_instruction(self):
425
430
}
426
431
stack_pointer[-3] = res;
427
432
stack_pointer += -2;
433
+ assert(WITHIN_STACK_BOUNDS());
428
434
DISPATCH();
429
435
}
430
436
@@ -459,6 +465,7 @@ def test_macro_instruction(self):
459
465
res = op3(arg2, left, right);
460
466
stack_pointer[-3] = res;
461
467
stack_pointer += -2;
468
+ assert(WITHIN_STACK_BOUNDS());
462
469
DISPATCH();
463
470
}
464
471
"""
@@ -540,6 +547,7 @@ def test_array_input(self):
540
547
below = stack_pointer[-2 - oparg*2];
541
548
spam();
542
549
stack_pointer += -2 - oparg*2;
550
+ assert(WITHIN_STACK_BOUNDS());
543
551
DISPATCH();
544
552
}
545
553
"""
@@ -564,6 +572,7 @@ def test_array_output(self):
564
572
stack_pointer[-2] = below;
565
573
stack_pointer[-1 + oparg*3] = above;
566
574
stack_pointer += oparg*3;
575
+ assert(WITHIN_STACK_BOUNDS());
567
576
DISPATCH();
568
577
}
569
578
"""
@@ -586,6 +595,7 @@ def test_array_input_output(self):
586
595
spam(values, oparg);
587
596
stack_pointer[0] = above;
588
597
stack_pointer += 1;
598
+ assert(WITHIN_STACK_BOUNDS());
589
599
DISPATCH();
590
600
}
591
601
"""
@@ -608,6 +618,7 @@ def test_array_error_if(self):
608
618
extra = stack_pointer[-1 - oparg];
609
619
if (oparg == 0) { stack_pointer += -1 - oparg; goto somewhere; }
610
620
stack_pointer += -1 - oparg;
621
+ assert(WITHIN_STACK_BOUNDS());
611
622
DISPATCH();
612
623
}
613
624
"""
@@ -638,6 +649,7 @@ def test_cond_effect(self):
638
649
if (oparg & 2) stack_pointer[-1 - (((oparg & 1) == 1) ? 1 : 0)] = output;
639
650
stack_pointer[-1 - (((oparg & 1) == 1) ? 1 : 0) + ((oparg & 2) ? 1 : 0)] = zz;
640
651
stack_pointer += -(((oparg & 1) == 1) ? 1 : 0) + ((oparg & 2) ? 1 : 0);
652
+ assert(WITHIN_STACK_BOUNDS());
641
653
DISPATCH();
642
654
}
643
655
"""
@@ -679,6 +691,7 @@ def test_macro_cond_effect(self):
679
691
if (oparg) stack_pointer[-2] = extra;
680
692
stack_pointer[-2 + ((oparg) ? 1 : 0)] = res;
681
693
stack_pointer += -1 + ((oparg) ? 1 : 0);
694
+ assert(WITHIN_STACK_BOUNDS());
682
695
DISPATCH();
683
696
}
684
697
"""
@@ -712,6 +725,7 @@ def test_macro_push_push(self):
712
725
stack_pointer[0] = val1;
713
726
stack_pointer[1] = val2;
714
727
stack_pointer += 2;
728
+ assert(WITHIN_STACK_BOUNDS());
715
729
DISPATCH();
716
730
}
717
731
"""
0 commit comments