brson · GitHub

added 2 commits

May 7, 2020 02:24
It is UB to construct out-of-bounds pointers.
Signed-off-by: Brian Anderson <andersrb@gmail.com>
Previous code creates aliasing mutable slices.
Signed-off-by: Brian Anderson <andersrb@gmail.com>

@brson

BusyJay

Signed-off-by: Brian Anderson <andersrb@gmail.com>

nrc

nrc approved these changes May 7, 2020

Signed-off-by: Brian Anderson <andersrb@gmail.com>

@sre-bot

@sre-bot

BusyJay

@ti-chi-bot ti-chi-bot Bot added the needs-rebase

Indicates a PR cannot be merged because it has merge conflicts with HEAD.

label

Apr 23, 2023

This was referenced

Aug 6, 2026

Merged

Closed

Merged

Merged

paulocsanz added a commit to paulocsanz/tikv that referenced this pull request

Aug 6, 2026
Stop advancing src_ptr after the empty terminator group (remaining==0).
The old loop always did ptr::add(MEMCMP_GROUP_SIZE) after every group;
after the final empty padded group that steps past one-past-the-end of
the allocation (UB under Rust pointer rules / Miri), same class as tikv#7751.
When len is a multiple of the group size the encoder still correctly
emits a full data group (padding 0) then one empty terminator group;
only the post-terminator advance is removed.
Also adds miri_soundness_mem_comparable_encode_all_naive which, under
Miri, fails on pre-fix code and checks equality with encode_all after
the fix.

Closed

paulocsanz added a commit to paulocsanz/tikv that referenced this pull request

Aug 6, 2026
Stop advancing src_ptr after the empty terminator group (remaining==0).
The old loop always did ptr::add(MEMCMP_GROUP_SIZE) after every group;
after the final empty padded group that steps past one-past-the-end of
the allocation (UB under Rust pointer rules / Miri), same class as tikv#7751.
When len is a multiple of the group size the encoder still correctly
emits a full data group (padding 0) then one empty terminator group;
only the post-terminator advance is removed.
Also adds miri_soundness_mem_comparable_encode_all_naive which, under
Miri, fails on pre-fix code and checks equality with encode_all after
the fix.
Signed-off-by: Paulo Cabral Sanz <paulo@railway.app>

paulocsanz added a commit to paulocsanz/tikv that referenced this pull request

Aug 6, 2026
Stop advancing src_ptr after the empty terminator group (remaining==0).
The old loop always did ptr::add(MEMCMP_GROUP_SIZE) after every group;
after the final empty padded group that steps past one-past-the-end of
the allocation (UB under Rust pointer rules / Miri), same class as tikv#7751.
When len is a multiple of the group size the encoder still correctly
emits a full data group (padding 0) then one empty terminator group;
only the post-terminator advance is removed.
Also adds miri_soundness_mem_comparable_encode_all_naive which, under
Miri, fails on pre-fix code and checks equality with encode_all after
the fix.
Signed-off-by: Paulo Cabral Sanz <paulosanz@poli.ufrj.br>

This was referenced

Aug 6, 2026

Closed

Merged

Merged

Read the original on github.com ↗