Repository navigation
Size unci generic-compression output exactly and fail allocations cleanly - #24
Merged
Merged
Conversation
…anly Follow-ups to the review of ente#19. - size the compressed output budget from what the reader consumes in every interleave mode, so pixel_size layouts with sub-byte groups decode compressed and excess output is rejected - reject layouts whose padding exceeds 8x their non-padded sample data and 16 MiB before decompressing, and reject large-window brotli streams before the decoder can request a ring buffer of up to 1 GiB - report ResourceLimit instead of aborting when the unci payload, channel, RGBA, tile scratch, conversion or transform allocations fail, and when the decompressed output buffer cannot grow - check multi-y component roles and sampling before the budget, so unsupported layouts keep reporting UnsupportedFeature - compare the budget with the reader across generated layouts
Author
|
@codex review |
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.
Follow-up to the review of #19.
Generic-compressed
unciitems now get an output budget that matches exactly what the reader consumes in every interleave mode.pixel_sizelayouts with sub-byte groups now decode compressed, and any decompressed bytes beyond the layout are rejected. Layouts whose padding (pixel_size, row or tile alignment, padded components) exceeds 8× their real sample data and 16 MiB are rejected before anything is decompressed, as are large-window brotli streams. Before this, a 232-byte file could make the brotli decoder request 1 GiB. Allocation failures on the unci decode path now reportResourceLimitinstead of aborting the process, including when the decompressed output buffer has to grow.Behaviour changes:
row_align_sizeare rejected, because the reader ignores that field. Plain copies still decode.DecodeUncompressedError::ResourceLimit,TransformGuardError::AllocationFailedandExtractUncompressedItemDataError::PayloadAllocationFailed. None of these enums isnon_exhaustive, so exhaustive downstream matches need updating.Known limits:
This overlaps with #13, which changes
pixel_sizeinto an exact stride. Whichever PR lands second must drop the one-byte residual inuncompressed_pixel_group_tile_size_bytes, and the new differential sweep test will fail until it does.Source fork PR: laurens-pilot#14
@laurenspriem