Fix Incorrect Pointer Increment in the function LasZipper::compress()#17
Merged
tmontaigu merged 1 commit intotmontaigu:masterfrom Nov 29, 2025
Merged
Conversation
Owner
|
Thanks for the fix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
First of all, thank you for providing this very useful library! I suspect there is a bug in
laspywhen handling large point clouds that originates from theLasZipper::compress()function.1. Fix pointer increment when processing large buffers
When the input buffer is very large, it gets split into several chunks. In those cases, the current code moves
in_ptrforward by the number of points, butin_ptris a byte pointer, so it should move by the number of bytes instead.This patch changes the increment to:
which ensures that the pointer increment logic is correct.
2. Move
seekg(0)to after the write (minor improvement)The patch also executes the reset of the read pointer after writing data into stringstream. This wasn’t a strict bug, as the original ordering often worked, but this ordering makes it clearer and reduces the chance of subtle ordering issues.
Thanks again for the great library and for taking the time to review this patch!