mediacodec: fix use-after-free
video.timestamp_fifo can be used from the video context.
Regression from cdff503e
Merge request reports
Activity
changed milestone to %4.0
added Component::Decoders Hw Platform::Android labels
added MRStatus::Reviewable label
- Resolved by Thomas Guillem
Nice catch!
I don't remember exactly why the two are not completely tied. IIRC flush or something else would lead to the destruction of the data in queued pictures, especially in transcode scenario, so the decoder instance is actually tied to the video context instead of the destruction of the decoder_t.
Nevertheless, I also find the commit message confusing. Maybe something in the lines of what follow would improve it?
mediacodec: release timestamp_fifo with video context `CleanInputVideo()` is linked to the input side of the decoder (.pf_decode) but `video.timestamp_fifo` can be used from the output side (threads from mediacodec) and is actually also tied to the lifecycle of the video context, as visible in the destructor `CloseDecoder`. Since the lifecycle of the video context is at least the one from the input side, destroy the timestamp_fifo there. Fixes a use-after-free when the video context is not released from CloseDestructor() while mediacodec is still running (not joined yet). Regression from cdff503e
Also, if I follow correctly, cdff503e established the baseline for the code but 57323dda is the commit that deferred the destruction and allowed this case to happen.
Edited by Alexandre Janniaux
added MRStatus::InReview label and removed MRStatus::Reviewable label
added 1 commit
- 240b14c4 - mediacodec: release timestamp_fifo with video context
added MRStatus::Acceptable label and removed MRStatus::InReview label
added MRStatus::Accepted label and removed MRStatus::Acceptable label
MR Acceptance result
This MergeRequest has been Accepted! Congratulations.MR acceptance checks details:
-
MR should be considered mergeable by Gitlab -
Last pipeline should be successful -
MergeRequest should have at least one external review and/or vote -
All threads should be resolved, and score >= 0 -
MergeRequest should have no activity (threads/votes) for (24h/24h)
-
added 35 commits
-
240b14c4...305ff7a2 - 34 commits from branch
videolan:master
- 1f7f400f - mediacodec: release timestamp_fifo with video context
-
240b14c4...305ff7a2 - 34 commits from branch
enabled an automatic merge when the pipeline for 1f7f400f succeeds