Fix B5 (is_file_type bounds check) and B6 (PLY vmap validation)#32
Merged
csparker247 merged 2 commits intodevelopfrom Mar 15, 2026
Merged
Fix B5 (is_file_type bounds check) and B6 (PLY vmap validation)#32csparker247 merged 2 commits intodevelopfrom
csparker247 merged 2 commits intodevelopfrom
Conversation
B5: Guard against empty extension string in is_file_type to avoid undefined behavior when a path has no extension. B6: Track which of x/y/z vertex properties are found during PLY header parsing and throw std::runtime_error if any are missing, preventing silent reads from the wrong column. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
B5:
is_file_typeinMeshIOFormats.hppcalledext[0]onpath.extension().string()without checking if the string was empty, causing undefined behavior for paths with no extension (e.g."mesh"). Added anext.empty()guard that returnsfalseearly.B6: The PLY reader initialized
vmap{}to{0,0,0}. If the PLY header was missing any of thex,y, orzvertex properties, the missing indices silently stayed at 0, causing reads from the wrong data column. Added avmapFoundtracking array and validation that throwsstd::runtime_errorif any of x/y/z are absent.Adds two new tests:
MeshIO.IsFileTypeNoExtension— asserts no-extension path returns false without UBMeshIO.PLY_MissingVertexProperty— assertsstd::runtime_errorfor a PLY with missingzTest plan
ctest100%)Closes #10
Closes #11