https://github.com/akkartik/mu/blob/main/linux/313index-bounds-check.subx
  1 
  2 
  3 
  4 == code
  5 
  6 __check-mu-array-bounds:  
  7     
  8     55/push-ebp
  9     89/<- %ebp 4/r32/esp
 10     
 11     50/push-eax
 12     51/push-ecx
 13     52/push-edx
 14     
 15     
 16     8b/-> *(ebp+0x10) 1/r32/ecx
 17     
 18     ba/copy-to-edx 0/imm32
 19     
 20     8b/-> *(ebp+8) 0/r32/eax
 21     f7 4/subop/multiply-eax-with *(ebp+0xc)
 22     
 23     81 7/subop/compare %edx 0/imm32
 24     0f 85/jump-if-!= __check-mu-array-bounds:overflow/disp32
 25     
 26     39/compare %eax 1/r32/ecx
 27     0f 82/jump-if-unsigned< $__check-mu-array-bounds:end/disp32  
 28     
 29     (write-buffered Stderr "fn ")
 30     (write-buffered Stderr *(ebp+0x14))
 31     (write-buffered Stderr ": offset ")
 32     (write-int32-hex-buffered Stderr %eax)
 33     (write-buffered Stderr " is too large for array '")
 34     (write-buffered Stderr *(ebp+0x18))
 35     (write-buffered Stderr "'\n")
 36     (flush Stderr)
 37     
 38     bb/copy-to-ebx 1/imm32
 39     e8/call syscall_exit/disp32
 40     
 41 $__check-mu-array-bounds:end:
 42     
 43     5a/pop-to-edx
 44     59/pop-to-ecx
 45     58/pop-to-eax
 46     
 47     89/<- %esp 5/r32/ebp
 48     5d/pop-to-ebp
 49     c3/return
 50 
 51 __check-mu-array-bounds:overflow:
 52     
 53     (write-buffered Stderr "fn ")
 54     (write-buffered Stderr *(ebp+0x14))
 55     (write-buffered Stderr ": offset to array '")
 56     (write-buffered Stderr *(ebp+0x18))
 57     (write-buffered Stderr "' overflowed 32 bits\n")
 58     (flush Stderr)
 59     
 60     bb/copy-to-ebx 1/imm32
 61     e8/call syscall_exit/disp32
 62     
 63 
 64 
 65 
 66 
 67 
 68 
 69 
 70 
 71 
 72 
 73 
 74 
 75 
 76 
 77 
 78 
 79 
 80 
 81 
 82 
 83 
 84 
 85 
 86 
 87 
 88 __mu-abort-null-index-base-address:
 89     (write-buffered Stderr "null address in 'index'\n")
 90     (flush Stderr)
 91     
 92     bb/copy-to-ebx 1/imm32
 93     e8/call syscall_exit/disp32
 94     
 95 
 96 __mu-abort-null-get-base-address:
 97     (write-buffered Stderr "null address in 'get'\n")
 98     (flush Stderr)
 99     
100     bb/copy-to-ebx 1/imm32
101     e8/call syscall_exit/disp32
102