Skip to content

Validate legacy MSH headers before parsing - #3493

Open
CoffeeDrivenCoder wants to merge 1 commit into
google-deepmind:mainfrom
CoffeeDrivenCoder:fix-msh-header-validation
Open

Validate legacy MSH headers before parsing#3493
CoffeeDrivenCoder wants to merge 1 commit into
google-deepmind:mainfrom
CoffeeDrivenCoder:fix-msh-header-validation

Conversation

@CoffeeDrivenCoder

Copy link
Copy Markdown

Summary

  • read the four legacy MSH header counts together and reject truncated headers
  • reject negative counts before passing them to NumPy data reads
  • report the actual expected texcoord count instead of the literal placeholder
  • add regression coverage for empty, truncated, negative-count, and incomplete-texcoord files

Previously, empty or truncated files leaked an internal IndexError, while negative counts reached np.fromfile where -1 has special read-to-EOF semantics. These inputs now fail consistently with a descriptive ValueError.

Testing

  • msh2obj_test.py: 4 tests passed, including the existing MSH-to-OBJ model equivalence test
  • pyink --check on both changed Python files
  • isort --check-only on both changed Python files
  • git diff --check

@google-cla

google-cla Bot commented Aug 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Signed-off-by: CoffeeDrivenCoder <wk.zjuvai@gmail.com>
@CoffeeDrivenCoder
CoffeeDrivenCoder force-pushed the fix-msh-header-validation branch from d209079 to b3579d1 Compare August 20, 2026 10:23
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.

1 participant