Skip DEBUG_VERBOSE end print for point writes

Point writes are recorded with the 2-argument
interleaved_insert::Result constructor, which leaves endRemaining
indeterminate, so the Phase 2 debug print in interleavedWrites read an
indeterminate span and, with stack garbage left over from an earlier
call, dereferenced a freed pointer. Confirmed with valgrind on a point
write following a range write: "Conditional jump or move depends on
uninitialised value(s)" and "Invalid read of size 1" at
ConflictSet.cpp:4984, and ASan heap-use-after-free in the same place.

Only print the end search path and spans for range writes, mirroring the
`if (e != nullptr)` check that already guards the endInsertionPoint
forwarding-chain fixup a few lines above. Production code already treats
endRemaining as range-write only, so nothing else changes.
This commit is contained in:
weaselbot committed 2026-10-27 13:07:00 -04:00
1 parent ba781b8875
commit a792352387
1 file changed
+5 -3
+5 -3
View File
@@ -4979,9 +4979,11 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
fprintf(stderr, "search path: %s, begin: %s\n",
getSearchPathPrintable(b).c_str(),
printable(context.results[i].remaining).c_str());
fprintf(stderr, "search path: %s, end: %s\n",
getSearchPathPrintable(e).c_str(),
printable(context.results[i].endRemaining).c_str());
if (e != nullptr) {
fprintf(stderr, "search path: %s, end: %s\n",
getSearchPathPrintable(e).c_str(),
printable(context.results[i].endRemaining).c_str());
}
}
#endif