diff options
| author | andromeda <andromeda@lenovo> | 2026-03-18 16:21:34 +0100 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-03-18 16:21:34 +0100 |
| commit | de60e52c5af08d57cf83b5b110ec19562aa41b17 (patch) | |
| tree | 4c993f796d7a8e1bace0cb83ab65dec91cad235f /twasm/asm/main.asm | |
| parent | 17a0a1a406bb52bde8c1306cd7ff44c00acb84de (diff) | |
range check char length
Diffstat (limited to 'twasm/asm/main.asm')
| -rw-r--r-- | twasm/asm/main.asm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/twasm/asm/main.asm b/twasm/asm/main.asm index f4f13af..ead107e 100644 --- a/twasm/asm/main.asm +++ b/twasm/asm/main.asm @@ -866,7 +866,8 @@ evaluate_constant: jmp .bin_loop .chr: - ; TODO range check rcx + cmp rcx, 4 ; ensure char is only 4 bytes long + jg .unrecognised cmp rsi, 1 ; range check je .chr_break @@ -896,7 +897,7 @@ evaluate_constant: jmp .chr_break .chr_break_for_good: - mov dl, [rdi] + mov dl, [rdi] ; make sure the chr is closed cmp dl, '"' jne .unrecognised |
