Repository navigation
Never crash: Check raw data size before allocating in PEF, TIFF tiles and ARW6 (#1512) - #1776
Merged
Merged
Conversation
… and ARW6 (storytold#1512) A compressed PEF too short for its size, an uncompressed tile claiming far more samples than it holds, and an ARW6 with a failed tile now get refused before the big buffer is allocated.
bogusyogi
added a commit
to Orthic-Labs/ember
that referenced
this pull request
Oct 15, 2026
… and ARW6 (storytold#1512) (upstream storytold#1776) Applied from storytold/lightcraft PR storytold#1776 (open upstream, not yet merged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Thank you @endthestart! This landed on main in integration batch 36 (#1843). If you haven't already, please join our Discord: https://discord.gg/artcraft. We'd love to have you there. |
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.
Three places allocated the full picture before checking the data could fill it. A compressed PEF now has to have at least one bit per sample, since every Huffman code is at least that long. An uncompressed TIFF tile or strip holding less than 1/64 of what its samples need is refused (short ones are still padded with zeros like before). ARW6 collects the tile results and stops at the first failed tile before allocating the mosaic. So a few KB can't ask for gigabytes anymore.
I added tests for the PEF and tile cases, for example a 4 KB PEF stream claiming 30000 x 30000 is refused right away. The ARW6 one only moves the error check before the allocation, and the raws in the corpus still decode the same. Thanks!
Fixes #1512