avifDecoderReset: only inspect the first color tile if color tiles exist #3426
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 209 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.320
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3426"
general
weight: 0.35
y-guyon
Problem
avifDecoderReset()checks the first colour tile whenever the primarycolour item's
progressiveflag is set. That flag is set during tilegeneration and never cleared, but Reset first clears all tiles
(
tiles.count = 0,tile->input = NULL).So this sequence crashes:
1. Parse a progressive AVIF with colour enabled.
2. Change
imageContentToDecodeto exclude colour.3. Call
avifDecoderReset().Reset re-enters with the flag still set but no colour tiles, and reads
samples.countthrough a NULLinputpointer (NULL + 0xc). ASanreports a SEGV at
src/read.c:6655inavifDecoderReset. ChangingimageContentToDecodebetween Reset calls is already used in the testsuite (
avifgainmaptest.cc,avif_fuzztest_dec.cc).Impact: crash-only NULL dereference. No memory corruption, information
disclosure, or attacker control over the faulting address.
Fix
Also require
data->tileInfos[AVIF_ITEM_COLOR].tileCount > 0beforeentering the block — the same check used nearby for whether tiles were
generated for a category. If no colour tiles were generated, there is
no progressive colour state to report. One line in
src/read.c.Testing
Adds
DecodeProgressiveTest.ResetAfterExcludingColortotests/gtest/avifprogressivetest.cc, withtests/data/white_1x1_a1lx_progressive.avif. The test runs thesequence above through the public API: unpatched, it dies with the
same SEGV at
src/read.c:6655; patched, it passes.Also checked with an ASan build and public-API harness: patched
returns
AVIF_RESULT_OK; parsing the crafted file with colour stillreports
progressiveStateAVAILABLE; the non-progressive donor fileis unaffected.