ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Sun Mar  2 23:09:39 2025 +0100| [c050269edaca7e0b63b59cd214dc32f79b0eef1a] | 
committer: Andreas Rheinhardt

avcodec/mpeg4videodec: Bail out earlier when parsing

The scantables are unused for the parser (and in fact
the IDCT permutation used has not been initialized at all).

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

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

 libavcodec/mpeg4videodec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index eace43b4cb..2a340ea682 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3250,6 +3250,12 @@ static int decode_vop_header(Mpeg4DecContext *ctx, 
GetBitContext *gb,
         } else
             s->alternate_scan = 0;
     }
+    /* Skip at this point when only parsing since the remaining
+     * data is not useful for a parser and requires the
+     * sprite_trajectory VLC to be initialized. */
+    if (parse_only)
+        goto end;
+
     if (s->alternate_scan) {
         ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,   
ff_alternate_vertical_scan);
         ff_permute_scantable(s->permutated_intra_h_scantable, 
ff_alternate_vertical_scan,
@@ -3262,12 +3268,6 @@ static int decode_vop_header(Mpeg4DecContext *ctx, 
GetBitContext *gb,
     ff_permute_scantable(s->permutated_intra_v_scantable, 
ff_alternate_vertical_scan,
                          s->idsp.idct_permutation);
 
-    /* Skip at this point when only parsing since the remaining
-     * data is not useful for a parser and requires the
-     * sprite_trajectory VLC to be initialized. */
-    if (parse_only)
-        goto end;
-
     if (s->pict_type == AV_PICTURE_TYPE_S) {
         if((ctx->vol_sprite_usage == STATIC_SPRITE ||
             ctx->vol_sprite_usage == GMC_SPRITE)) {

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to