Skip to content

Fix read data overwrite issue#20

Merged
bertmelis merged 1 commit intobertmelis:mainfrom
urbytes21:main
Feb 4, 2026
Merged

Fix read data overwrite issue#20
bertmelis merged 1 commit intobertmelis:mainfrom
urbytes21:main

Conversation

@urbytes21
Copy link
Contributor

No description provided.

@urbytes21
Copy link
Contributor Author

@bertmelis Could you please help me review this PR ? Thank you.

@bertmelis bertmelis merged commit 3f47408 into bertmelis:main Feb 4, 2026
3 checks passed
@bertmelis
Copy link
Owner

Good catch. Thank you for the fix!

@bertmelis bertmelis linked an issue Feb 4, 2026 that may be closed by this pull request
@bertmelis bertmelis changed the title Fix read data overwrite issue #19 Fix read data overwrite issue Feb 4, 2026
@bertmelis
Copy link
Owner

bertmelis commented Feb 4, 2026

I forgot to ask for a change: when advancing the start pointer of the destination, the size has to be adjusted or we risk a buffer overflow.

I can fix this later or you could add another PR?

Something like this?

...
while (size >= pxItemSize) {
...
size -= pxItemSize;
...
}

@urbytes21
Copy link
Contributor Author

Ah, missed this.
size is the target read size, retVal is the bytes already read,
So I think we should change the loop condition to while (size > retVal) instead of checking pxItemSize.

Thank you

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.

Potential data overwrite when reading in chucks

2 participants