Skip to content

Conversation

@chegoryu
Copy link
Contributor

@chegoryu chegoryu commented Dec 3, 2025

Rationale for this change

Fixing: #48311

What changes are included in this PR?

Applied fix from #48311 and added test

Are these changes tested?

Yes, added test, without my patch test fails with debug check:

Note: Google Test filter = TestBufferedInputStream.PeekAfterExhaustingBuffer
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestBufferedInputStream
[ RUN      ] TestBufferedInputStream.PeekAfterExhaustingBuffer
/Users/chegoryu/Junk/git/arrow/cpp/src/arrow/io/buffered.cc:337:  Check failed: buffer_->size() - buffer_pos_ >= nbytes

Are there any user-facing changes?

No, this PR fixes a bug

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

⚠️ GitHub issue #48311 has been automatically assigned in GitHub to PR creator.

@chegoryu
Copy link
Contributor Author

chegoryu commented Jan 1, 2026

@wgtmac Hi, I don't know who to ping, so I chose you since you’ve looked at one of my reviews.

Can you suggest the right person to call to review this? This bug is really annoying and appears very randomly (and looks like a corrupted allocator, so it's hard to debug).

@wgtmac
Copy link
Member

wgtmac commented Jan 7, 2026

cc @mapleFU

// No need to reserve space for more than the total remaining number of bytes.
if (bytes_buffered_ == 0) {
// Special case: we can not keep the current buffer because it does not
// Special case: we can override data in the current buffer because it does not
Copy link
Member

Choose a reason for hiding this comment

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

Can you rewrite comment in SetBufferSize? Since buffer_pos_ would be rewritten now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missed that comment, thanks, fixed

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants