Skip to content

Fix size calculation for final block - #9573

Open
kevinbackhouse wants to merge 1 commit into
Exiv2:0.28.xfrom
kevinbackhouse:populateFakeData
Open

kevinbackhouse wants to merge 1 commit into
Exiv2:0.28.xfrom
kevinbackhouse:populateFakeData

Conversation

@kevinbackhouse

Copy link
Copy Markdown
Collaborator

I'm doing a few extra fixes to go with #9572. I'm not sure if it's possible to trigger this bug, but it's better to fix it.

populateFakeData() is currently setting the size of all the blocks to p_->blockSize_. But if p_->size_ isn't an exact multiple of p_->blockSize_ then the final block might be smaller. I've fixed it by tracking the number of remaining bytes instead.

Copilot AI balanced review requested due to automatic review settings November 22, 2026 21:44
@kevinbackhouse kevinbackhouse added this to the v0.28.10 milestone Nov 22, 2026
@kevinbackhouse kevinbackhouse added the forward-to-main Forward changes in a 0.29.x PR to main with Mergify label Nov 22, 2026
@mergify

mergify Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the change correcting partial final-block sizing in RemoteIo::populateFakeData().

No open issues 🎉

What changed in this PR

Corrects final-block sizing in RemoteIo::populateFakeData(), complementing the block-size checks in #9572.

Changes:

  • Tracks remaining bytes instead of calculating the number of blocks upfront.
  • Marks unpopulated blocks with the smaller of the remaining byte count and the configured block size.
File Description
src/​basicio.cpp Uses the actual remaining size for a partial final block.

Review effort: Balanced

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

Labels

forward-to-main Forward changes in a 0.29.x PR to main with Mergify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants