mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
check that jumps are within the range of a signed 16-bit int
* module/language/assembly/compile-bytecode.scm (write-bytecode): Check that the offset is within the range of a signed int16 value.
This commit is contained in:
parent
d95eb7f49f
commit
74deff3c43
1 changed files with 4 additions and 1 deletions
|
@ -77,7 +77,10 @@
|
|||
;; Ew!
|
||||
(for-each write-byte (bytevector->u8-list bv)))
|
||||
(define (write-break label)
|
||||
(write-uint16-be (- (assq-ref labels label) (+ (get-addr) 2))))
|
||||
(let ((offset (- (assq-ref labels label) (+ (get-addr) 2))))
|
||||
(cond ((>= offset (ash 1 15)) (error "jump too big" offset))
|
||||
((< offset (- (ash 1 15))) (error "reverse jump too big" offset))
|
||||
(else (write-uint16-be offset)))))
|
||||
|
||||
(let ((inst (car asm))
|
||||
(args (cdr asm))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue