diff mbox series

[FFmpeg-devel,4/6] avcodec/rv10: Don't presume context to be initialized

Message ID HE1PR0301MB215482599AA95F064BEBD1B28F779@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 8ffd3ef9d94f33b411348c594a49d994b55c9550
Headers show
Series [FFmpeg-devel,1/6] Revert "avcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common_init()" | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 5, 2021, 1:44 a.m. UTC
In case of resolution changes rv20_decode_picture_header() closes and
reopens its MpegEncContext; it checks the latter for errors, yet when
an error happens, it might happen that no new attempt at
reinitialization is performed when decoding the next frame; this leads
to crashes lateron.

This commit changes this by making sure that initialization will always
be attempted if the context is currently not initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/rv10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 89b838ad15..bd70689cab 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -226,7 +226,7 @@  static int rv20_decode_picture_header(RVDecContext *rv)
             new_w = rv->orig_width;
             new_h = rv->orig_height;
         }
-        if (new_w != s->width || new_h != s->height) {
+        if (new_w != s->width || new_h != s->height || !s->context_initialized) {
             AVRational old_aspect = s->avctx->sample_aspect_ratio;
             av_log(s->avctx, AV_LOG_DEBUG,
                    "attempting to change resolution to %dx%d\n", new_w, new_h);