Skip to content

Size unci generic-compression output exactly and fail allocations cleanly - #14

Closed
laurens-pilot wants to merge 1 commit into
mainfrom
fix/unci-budget-followups
Closed

laurens-pilot wants to merge 1 commit into
mainfrom
fix/unci-budget-followups

Conversation

@laurens-pilot

Copy link
Copy Markdown
Owner

Follow-up to the review of ente#19.

Generic-compressed unci items now get an output budget that matches exactly what the reader consumes in every interleave mode. pixel_size layouts 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 report ResourceLimit instead of aborting the process, including when the decompressed output buffer has to grow.

Behaviour changes:

  • Mixed-interleave row padding: compressed mixed-interleave payloads padded for row_align_size are rejected, because the reader ignores that field. Plain copies still decode.
  • New public error variants: DecodeUncompressedError::ResourceLimit, TransformGuardError::AllocationFailed and ExtractUncompressedItemDataError::PayloadAllocationFailed. None of these enums is non_exhaustive, so exhaustive downstream matches need updating.
  • Fallible transform allocations: rotate, mirror and crop now allocate fallibly on every decode path, including HEIC.

Known limits:

  • Remaining aborts: fixed codec state (flate2 buffers and decoder state, standard-window brotli state), allocations proportional to the input size, and error strings can still abort on allocation failure.
  • Not tested: 32-bit builds.

This overlaps with #13, which changes pixel_size into an exact stride. Whichever PR lands second must drop the one-byte residual in uncompressed_pixel_group_tile_size_bytes, and the new differential sweep test will fail until it does.

…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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T07:39:15.267654Z 9009609 Manual request
🔒 Security Review ✅ Completed 2026-11-02T07:41:14.857680Z 9009609 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@laurens-pilot

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 9009609af8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 9009609af8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@laurens-pilot

Copy link
Copy Markdown
Owner Author

Superseded by ente#24.

@laurens-pilot
laurens-pilot deleted the fix/unci-budget-followups branch November 2, 2026 10:03
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.

2 participants