diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-07-16 17:06:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-16 17:06:39 +0200 |
| commit | 7b5e08f8ef03ef3b56c65c3c80a0eb0c47884864 (patch) | |
| tree | 5c109dcfe9295c23c583342e975e865b8a2f8599 /compiler/rustc_const_eval | |
| parent | 17332ed91648d84ab317e772d5611c74c1df06aa (diff) | |
| parent | 925789456aa0bb112d8ab2fe3f31f4f7317f463b (diff) | |
| download | rust-7b5e08f8ef03ef3b56c65c3c80a0eb0c47884864.tar.gz rust-7b5e08f8ef03ef3b56c65c3c80a0eb0c47884864.zip | |
Rollup merge of #143692 - RalfJung:miri-oob, r=oli-obk
miri: fix out-of-bounds error for ptrs with negative offsets r? ```````@oli-obk```````
Diffstat (limited to 'compiler/rustc_const_eval')
| -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 b767ca9a3c2..c9b7356432d 100644 --- a/compiler/rustc_const_eval/messages.ftl +++ b/compiler/rustc_const_eval/messages.ftl @@ -296,19 +296,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 = |
