Fix invalid pointer dereference in OBJ decoder for faces without vertices#1204
Open
gn00295120 wants to merge 1 commit into
Open
Fix invalid pointer dereference in OBJ decoder for faces without vertices#1204gn00295120 wants to merge 1 commit into
gn00295120 wants to merge 1 commit into
Conversation
…ices ObjDecoder crashes when an OBJ file has face definitions but no vertex positions. pos_att_id_ stays at -1, so attribute(-1) reads out of bounds. Negative OBJ indices also aren't bounds-checked. - Reject files with faces but zero positions after the counting pass - Guard MapPointToVertexIndices against pos_att_id_ < 0 - Validate resolved negative indices are non-negative
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.
Summary
ObjDecodercrashes when an OBJ file contains face definitions (f 1 2 3) but no preceding vertex positions (v ...). The position attribute ID stays at its initial value of -1, andPointCloud::attribute(-1)dereferences out of bounds.Additionally, negative OBJ vertex indices (e.g.,
f -1 -2 -3) are resolved againstnum_positions_without checking for underflow.Changes
MapPointToVertexIndicesagainstpos_att_id_ < 0Reproduction
ASAN trace (before fix):