Repository navigation
Reset Sample Transform state in avifDecoderReset() - #3327
Merged
y-guyon merged 2 commits intoAug 21, 2026
Merged
Conversation
Clear the parsed Sample Transform expression and input count before the decode input is rebuilt. Otherwise a second reset, including one performed by avifDecoderSetSource(), encounters stale state and returns AVIF_RESULT_INTERNAL_ERROR, or asserts in debug builds. Add coverage for direct reset and avifDecoderSetSource(). Signed-off-by: David Sarkisyan <david@srkyn.com>
y-guyon
approved these changes
Aug 20, 2026
y-guyon
left a comment
Contributor
There was a problem hiding this comment.
Thank you for the fix. Could you add it to the CHANGELOG please?
Signed-off-by: David Sarkisyan <david@srkyn.com>
Contributor
Author
|
Added the CHANGELOG entry under Unreleased. Thanks! |
y-guyon
approved these changes
Aug 21, 2026
wantehchang
reviewed
Aug 21, 2026
| } | ||
| avifDecoderDataClearTiles(data); | ||
| data->sampleTransformNumInputImageItems = 0; | ||
| avifArrayDestroy(&data->meta->sampleTransformExpression); |
Member
There was a problem hiding this comment.
I suggest we also set data->meta->sampleTransformDepth to an invalid value such as 0.
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.
avifDecoderReset()leaves the parsed Sample Transform expression and input count in the decoder data. Calling reset again then adds the inputs a second time. In debug builds this reaches an assertion because the count is expected to start at zero. In release builds the reset returnsAVIF_RESULT_INTERNAL_ERROR.Clear both fields with the rest of the per-parse decoder state. The new test uses the existing
weld_sato_12B_8B_q0.aviffixture and covers explicit reset and the reset performed byavifDecoderSetSource().Tested with the full ASan and UBSan configuration. All 51 tests passed.