diff options
| author | Ralf Jung <post@ralfj.de> | 2025-07-09 18:12:31 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-07-09 20:20:07 +0200 |
| commit | 925789456aa0bb112d8ab2fe3f31f4f7317f463b (patch) | |
| tree | 65c265f4c3cfc04d0585d10e6d660c4d083f1b9e /compiler/rustc_const_eval/messages.ftl | |
| parent | 6b3ae3f6e45a33c2d95fa0362c9b2593e567fd34 (diff) | |
| download | rust-925789456aa0bb112d8ab2fe3f31f4f7317f463b.tar.gz rust-925789456aa0bb112d8ab2fe3f31f4f7317f463b.zip | |
miri: fix out-of-bounds error for ptrs with negative offsets
Diffstat (limited to 'compiler/rustc_const_eval/messages.ftl')
| -rw-r--r-- | compiler/rustc_const_eval/messages.ftl | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl index 22a1894ee72..dd12afb2853 100644 --- a/compiler/rustc_const_eval/messages.ftl +++ b/compiler/rustc_const_eval/messages.ftl @@ -294,19 +294,22 @@ const_eval_pointer_arithmetic_overflow = overflowing pointer arithmetic: the total offset in bytes does not fit in an `isize` const_eval_pointer_out_of_bounds = - {const_eval_bad_pointer_op_attempting}, but got {$pointer} which {$inbounds_size_is_neg -> - [false] {$alloc_size_minus_ptr_offset -> - [0] is at or beyond the end of the allocation of size {$alloc_size -> - [1] 1 byte - *[x] {$alloc_size} bytes + {const_eval_bad_pointer_op_attempting}, but got {$pointer} which {$ptr_offset_is_neg -> + [true] points to before the beginning of the allocation + *[false] {$inbounds_size_is_neg -> + [false] {$alloc_size_minus_ptr_offset -> + [0] is at or beyond the end of the allocation of size {$alloc_size -> + [1] 1 byte + *[x] {$alloc_size} bytes + } + [1] is only 1 byte from the end of the allocation + *[x] is only {$alloc_size_minus_ptr_offset} bytes from the end of the allocation + } + *[true] {$ptr_offset_abs -> + [0] is at the beginning of the allocation + *[other] is only {$ptr_offset_abs} bytes from the beginning of the allocation } - [1] is only 1 byte from the end of the allocation - *[x] is only {$alloc_size_minus_ptr_offset} bytes from the end of the allocation - } - *[true] {$ptr_offset_abs -> - [0] is at the beginning of the allocation - *[other] is only {$ptr_offset_abs} bytes from the beginning of the allocation - } + } } const_eval_pointer_use_after_free = |
