Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/stl deserialization validation #6

Merged
merged 2 commits into from
Aug 9, 2024

Conversation

jeanchristopheruel
Copy link
Member

This pull request enhances the STL deserialization process by adding validation for truncated headers and includes new unit tests to ensure robustness.
Key Changes:

Deserializer Validation:

    Updated deserializeBinaryStl to check file size before reading the header, ensuring the file is large enough for a valid STL header and triangle count.
    Improved error handling to detect and throw exceptions for truncated or corrupt files.

Unit Tests:

    Added tests for truncated headers, ensuring the deserializer throws an exception when encountering an incomplete header.
    Included tests for handling the maximum number of triangles and validating behavior when the limit is exceeded.

Disclaimer:

    Added a disclaimer to the documentation, noting the limitations of the STL binary format and the absence of built-in validation mechanisms like checksums.

- Added a disclaimer section to the README highlighting the limitations of the STL file format, including the lack of built-in validation mechanisms and the potential for buffer overflow attacks.
- Improved deserialization function to include strict validation for file size and data integrity, particularly addressing the handling of truncated headers.
- Implemented strict validation in `deserializeBinaryStl` to ensure the file is large enough for a valid STL header (80 bytes) and triangle count (4 bytes).
- Added test cases for handling truncated headers, verifying that deserialization throws an exception when the header is incomplete.
- Improved error handling to check for file corruption or incompleteness during deserialization.
@jeanchristopheruel jeanchristopheruel self-assigned this Aug 9, 2024
@jeanchristopheruel jeanchristopheruel merged commit 3db22e0 into main Aug 9, 2024
9 checks passed
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