Repository navigation
Commit 06c3fa8
authored
CABI: trap on misaligned error-context.debug-message ptr (#740)
canon_error_context_debug_message stored the debug string's (pointer,
length) pair at the guest-supplied `ptr` with store_string, which writes
through store_int without any alignment or bounds check. A misaligned `ptr`
was thus accepted, and an out-of-bounds `ptr` silently grew the Python
bytearray backing linear memory (appending at its current end) instead of
trapping.
Check `ptr` the same way lower_flat_values checks an out-param pointer
before storing a spilled tuple: trap unless `ptr` is aligned to
alignment(string) and `ptr + elem_size(string)` is within memory, then go
through store, whose assertions these checks discharge. The checks run
before opts.realloc is called.
Assisted-by: claude:claude-opus-5-51 parent 6cd6393 commit 06c3fa8
3 files changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4832 | 4832 | | |
4833 | 4833 | | |
4834 | 4834 | | |
4835 | | - | |
| 4835 | + | |
| 4836 | + | |
| 4837 | + | |
4836 | 4838 | | |
4837 | 4839 | | |
4838 | 4840 | | |
4839 | 4841 | | |
4840 | | - | |
| 4842 | + | |
| 4843 | + | |
| 4844 | + | |
| 4845 | + | |
4841 | 4846 | | |
4842 | 4847 | | |
4843 | 4848 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2399 | 2399 | | |
2400 | 2400 | | |
2401 | 2401 | | |
2402 | | - | |
| 2402 | + | |
| 2403 | + | |
2403 | 2404 | | |
2404 | 2405 | | |
2405 | 2406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2664 | 2664 | | |
2665 | 2665 | | |
2666 | 2666 | | |
2667 | | - | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
2668 | 2670 | | |
2669 | 2671 | | |
2670 | 2672 | | |
| |||
0 commit comments