format: checked chunk addresses on the parallel read path
Three `chunk_info.address as usize` casts behind the `parallel` feature survived the conversion, because check-32bit-casts.sh linted only default features plus plugin-filters. On a 32-bit target with rayon a chunk address past 4 GiB still wrapped onto another part of the file. They go through addr::to_usize now, and the lane index (h % n, always < n) through saturating_usize. The script now lints no default features, default features, and every optional feature but szip (wasm32; the set with zstd, which does not build for wasm32, on the host, where the lint reports the same casts). With the old parallel_read.rs/lane_partition.rs it fails listing the four casts; the old script passed them. CHANGELOG and the design note give the exact count (119) and what is not covered. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -112,7 +112,8 @@ pub fn partition(
|
||||
|
||||
for idx in 0..num_items {
|
||||
let h = fxhash_combine(seed, idx as u64);
|
||||
let lane = (h % num_lanes as u64) as usize;
|
||||
// Below `num_lanes`, so it fits.
|
||||
let lane = crate::addr::saturating_usize(h % num_lanes as u64);
|
||||
lanes[lane].push(idx);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user