ci: Remove unused workaround after leveldb subtree bump
What changed, and why it matters
This commit removes a temporary workaround from Bitcoin Core's continuous integration (CI) test script. The workaround previously patched LevelDB source code during CI runs to avoid reading from uninitialized memory. The removal is cleanup after a LevelDB update made the workaround unnecessary. It is not a security fix and does not change any production code.
No security action needed. This is routine CI cleanup following a dependency update.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff deletes a shell block in ci/test/03_test_script.sh that conditionally applied an inline patch to src/leveldb/db/db_impl.cc. The patch removed a loop that added compact->outputs[i].file_size to stats.bytes_written, because file_size was uninitialized memory and reading it was undefined behavior. The commit message states this workaround is now unused after a LevelDB subtree bump. No runtime or consensus code is modified.
Changed components
ci/test/03_test_script.shInspect captured patch +0 / −26
diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh
index 3908b274..e77ecd81 100755
--- a/ci/test/03_test_script.sh
+++ b/ci/test/03_test_script.sh
@@ -44,32 +44,6 @@ echo "=== BEGIN env ==="
env
echo "=== END env ==="
-# Don't apply patches in the iwyu job, because it relies on the `git diff`
-# command to detect IWYU errors. It is safe to skip this patch in the iwyu job
-# because it doesn't run a UB detector.
-if [[ "${RUN_IWYU}" != true ]]; then
- # compact->outputs[i].file_size is uninitialized memory, so reading it is UB.
- # The statistic bytes_written is only used for logging, which is disabled in
- # CI, so as a temporary minimal fix to work around UB and CI failures, leave
- # bytes_written unmodified.
- # See https://github.com/bitcoin/bitcoin/pull/28359#issuecomment-1698694748
- # Tee patch to stdout to make it clear CI is testing modified code.
- tee >(patch -p1) <<'EOF'
---- a/src/leveldb/db/db_impl.cc
-+++ b/src/leveldb/db/db_impl.cc
-@@ -1028,9 +1028,6 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) {
- stats.bytes_read += compact->compaction->input(which, i)->file_size;
- }
- }
-- for (size_t i = 0; i < compact->outputs.size(); i++) {
-- stats.bytes_written += compact->outputs[i].file_size;
-- }
-
- mutex_.Lock();
- stats_[compact->compaction->level() + 1].Add(stats);
-EOF
-fi
-
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_corpora/
if [ ! -d "$DIR_FUZZ_IN" ]; then
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.