Skip to content

Fix off-by-one buffer overflow in integration test mergeFunction#243

Open
RaionG18 wants to merge 1 commit into
High-Performance-IO:masterfrom
RaionG18:fix/integration-resultpath-buffer-overflow
Open

Fix off-by-one buffer overflow in integration test mergeFunction#243
RaionG18 wants to merge 1 commit into
High-Performance-IO:masterfrom
RaionG18:fix/integration-resultpath-buffer-overflow

Conversation

@RaionG18

Copy link
Copy Markdown

resultpath was allocated as strlen(destdir) + strlen("/result.dat") bytes, but the subsequent sprintf writes that many characters plus the terminating NUL, overflowing the heap buffer by one byte.

With _FORTIFY_SOURCE active (e.g. -O3 on recent GCC/glibc) the fortified sprintf detects the overflow and aborts with "*** buffer overflow detected ***", crashing the RunTestSplitMergeAndMapReduceFunction integration test.

Reserve one extra byte for the NUL terminator.

`resultpath` was allocated as `strlen(destdir) + strlen("/result.dat")`
bytes, but the subsequent sprintf writes that many characters plus the
terminating NUL, overflowing the heap buffer by one byte.

This is harmless under low optimization, but with _FORTIFY_SOURCE active
(e.g. -O3 on recent GCC/glibc) the fortified sprintf detects the overflow
and aborts with "*** buffer overflow detected ***", crashing the
RunTestSplitMergeAndMapReduceFunction integration test.

Reserve one extra byte for the NUL terminator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.46%. Comparing base (07427e3) to head (6fdb473).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #243      +/-   ##
==========================================
+ Coverage   63.45%   63.46%   +0.01%     
==========================================
  Files          78       79       +1     
  Lines        3273     3274       +1     
  Branches     2008     2008              
==========================================
+ Hits         2077     2078       +1     
+ Misses        938      399     -539     
- Partials      258      797     +539     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

marcoSanti
marcoSanti previously approved these changes Jun 28, 2026

@marcoSanti marcoSanti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@marcoSanti marcoSanti dismissed their stale review June 28, 2026 19:45

Using LLMs might have licensing issues. Removing approval pending investigation of licensing issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants