While exercising RealDataBench.cpp with a minimal dataset, it aborts immediately on a std::span bounds assertion.
Locations
RealDataBench.cpp line 89: write = line.subspan(2, line.size());
RealDataBench.cpp line 95: reads.push_back(line.subspan(2, line.size()));
std::span::subspan(offset, count) takes a count, not an end offset. For a line of length N, these calls request N bytes starting at offset 2, but only N - 2 bytes are available after the P / L prefix. In a Debug build this triggers the assertion from std::span::subspan (__offset + __count <= size()); in a Release build it silently reads into the following line's memory.
The intended expression is almost certainly line.subspan(2, line.size() - 2) (with a guard for lines shorter than 2 bytes).
Additional API contract violations
Line 103: iter->readVersion = version - 100; produces a negative readVersion for the first 100 batches, violating the documented requirement that all versions be >= 0. In Debug builds this aborts at ConflictSet.cpp:4873; in Release it wraps through InternalVersionT and yields incorrect conflict results.
Line 119: cs.setOldestVersion(version - 10000); produces a negative oldestVersion for the first 10 000 batches, violating the same contract and the monotonicity requirement for setOldestVersion.
Expected: The benchmark strips the two-byte prefix from each line without out-of-bounds access, and only passes non-negative, monotonically increasing versions to the conflict set.
Actual: It requests more bytes than the line contains, and passes negative readVersion / oldestVersion values during the warmup phase.
Impact
RealDataBench cannot run on the documented memetracker9 dataset without crashing in Debug or reading out of bounds in Release, and its early measurements are based on invalid API inputs.
While exercising `RealDataBench.cpp` with a minimal dataset, it aborts immediately on a `std::span` bounds assertion.
## Locations
- `RealDataBench.cpp` line 89: `write = line.subspan(2, line.size());`
- `RealDataBench.cpp` line 95: `reads.push_back(line.subspan(2, line.size()));`
`std::span::subspan(offset, count)` takes a *count*, not an end offset. For a line of length `N`, these calls request `N` bytes starting at offset `2`, but only `N - 2` bytes are available after the `P ` / `L ` prefix. In a Debug build this triggers the assertion from `std::span::subspan` (`__offset + __count <= size()`); in a Release build it silently reads into the following line's memory.
The intended expression is almost certainly `line.subspan(2, line.size() - 2)` (with a guard for lines shorter than 2 bytes).
## Additional API contract violations
- Line 103: `iter->readVersion = version - 100;` produces a negative `readVersion` for the first 100 batches, violating the documented requirement that all versions be `>= 0`. In Debug builds this aborts at `ConflictSet.cpp:4873`; in Release it wraps through `InternalVersionT` and yields incorrect conflict results.
- Line 119: `cs.setOldestVersion(version - 10000);` produces a negative `oldestVersion` for the first 10 000 batches, violating the same contract and the monotonicity requirement for `setOldestVersion`.
## Reproduction
```bash
printf 'P hello\nL world\n\n' > sample.txt
./real_data_bench sample.txt
```
Result (Debug build):
```
/usr/include/c++/16/span:442:
constexpr std::span<_Type, 18446744073709551615>::subspan(size_type, size_type):
Assertion '__offset + __count <= size()' failed.
```
## Expected vs actual
- **Expected:** The benchmark strips the two-byte prefix from each line without out-of-bounds access, and only passes non-negative, monotonically increasing versions to the conflict set.
- **Actual:** It requests more bytes than the line contains, and passes negative `readVersion` / `oldestVersion` values during the warmup phase.
## Impact
`RealDataBench` cannot run on the documented memetracker9 dataset without crashing in Debug or reading out of bounds in Release, and its early measurements are based on invalid API inputs.
weaselbot
was assigned by andrew2026-06-29 17:31:10 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
While exercising
RealDataBench.cppwith a minimal dataset, it aborts immediately on astd::spanbounds assertion.Locations
RealDataBench.cppline 89:write = line.subspan(2, line.size());RealDataBench.cppline 95:reads.push_back(line.subspan(2, line.size()));std::span::subspan(offset, count)takes a count, not an end offset. For a line of lengthN, these calls requestNbytes starting at offset2, but onlyN - 2bytes are available after theP/Lprefix. In a Debug build this triggers the assertion fromstd::span::subspan(__offset + __count <= size()); in a Release build it silently reads into the following line's memory.The intended expression is almost certainly
line.subspan(2, line.size() - 2)(with a guard for lines shorter than 2 bytes).Additional API contract violations
iter->readVersion = version - 100;produces a negativereadVersionfor the first 100 batches, violating the documented requirement that all versions be>= 0. In Debug builds this aborts atConflictSet.cpp:4873; in Release it wraps throughInternalVersionTand yields incorrect conflict results.cs.setOldestVersion(version - 10000);produces a negativeoldestVersionfor the first 10 000 batches, violating the same contract and the monotonicity requirement forsetOldestVersion.Reproduction
Result (Debug build):
Expected vs actual
readVersion/oldestVersionvalues during the warmup phase.Impact
RealDataBenchcannot run on the documented memetracker9 dataset without crashing in Debug or reading out of bounds in Release, and its early measurements are based on invalid API inputs.