[FFmpeg-cvslog] avcodec/rv10: Don't presume context to be initialized

Andreas Rheinhardt git at videolan.org
Thu Apr 8 13:53:37 EEST 2021


ffmpeg | branch: release/4.4 | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Apr  4 21:30:33 2021 +0200| [4562719c7d598e3efa884af23b1dd127287011b8] | committer: Andreas Rheinhardt

avcodec/rv10: Don't presume context to be initialized

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 fixes this by making sure that initialization will always
be attempted if the context is currently not initialized.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
(cherry picked from commit 8ffd3ef9d94f33b411348c594a49d994b55c9550)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4562719c7d598e3efa884af23b1dd127287011b8
---

 libavcodec/rv10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);



More information about the ffmpeg-cvslog mailing list