[libav-devel] [PATCH] Updated error codes and error log messages in mpeg4videodec.c

Jake Sebastian-Jones jake.sebastian-jones at linux.com
Thu Aug 6 04:40:12 CEST 2015


---
 libavcodec/mpeg4videodec.c | 209 ++++++++++++++++++++++++++++++---------------
 1 file changed, 138 insertions(+), 71 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index b09aeb2..e7b9bf6 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -377,20 +377,26 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
 {
     MpegEncContext *s = &ctx->m;
 
-    int mb_num_bits      = av_log2(s->mb_num - 1) + 1;
-    int header_extension = 0, mb_num, len;
+    int mb_num_bits = av_log2(s->mb_num - 1) + 1;
+    int header_extension  = 0, mb_num, len;
 
-    /* is there enough space left for a video packet + header */
-    if (get_bits_count(&s->gb) > s->gb.size_in_bits - 20)
-        return -1;
+    if (get_bits_count(&s->gb) > s->gb.size_in_bits - 20) {
+        av_log(s->avctx, AV_LOG_ERROR,
+               "buffer of size %d does not enough space for a video packet "
+               "of size %d + a header of size 20\n",
+               s->gb.size_in_bits, get_bits_count(&s->gb));
+        return AVERROR_INVALIDDATA;
+    }
 
     for (len = 0; len < 32; len++)
         if (get_bits1(&s->gb))
             break;
 
     if (len != ff_mpeg4_get_video_packet_prefix_length(s)) {
-        av_log(s->avctx, AV_LOG_ERROR, "marker does not match f_code\n");
-        return -1;
+        av_log(s->avctx, AV_LOG_ERROR,
+               "marker length %d does not match length of f_code %d\n",
+               len, ff_mpeg4_get_video_packet_prefix_length(s));
+        return AVERROR_INVALIDDATA;
     }
 
     if (ctx->shape != RECT_SHAPE) {
@@ -402,7 +408,7 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
     if (mb_num >= s->mb_num) {
         av_log(s->avctx, AV_LOG_ERROR,
                "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     if (s->pict_type == AV_PICTURE_TYPE_B) {
         int mb_x = 0, mb_y = 0;
@@ -414,8 +420,12 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
             if (++mb_x == s->mb_width)
                 mb_x = 0;
         }
-        if (mb_num >= s->mb_num)
-            return -1;  // slice contains just skipped MBs (already decoded)
+        if (mb_num >= s->mb_num) {
+            av_log(s->avctx, AV_LOG_ERROR,
+                   "slice contains just %d MBs with %d skipped "
+                   "(already decoded)\n", s->mb_num, mb_num);
+            return AVERROR_INVALIDDATA;
+        }
     }
 
     s->mb_x = mb_num % s->mb_width;
@@ -542,8 +552,9 @@ static inline int mpeg4_decode_dc(MpegEncContext *s, int n, int *dir_ptr)
         code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1);
 
     if (code < 0 || code > 9 /* && s->nbit < 9 */) {
-        av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
-        return -1;
+        av_log(s->avctx, AV_LOG_ERROR,
+               "dc vlc %d is not in valid range [0,9]\n", code);
+        return AVERROR_INVALIDDATA;
     }
 
     if (code == 0) {
@@ -566,7 +577,7 @@ static inline int mpeg4_decode_dc(MpegEncContext *s, int n, int *dir_ptr)
             if (get_bits1(&s->gb) == 0) { /* marker */
                 if (s->avctx->err_recognition & AV_EF_BITSTREAM) {
                     av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n");
-                    return -1;
+                    return AVERROR_INVALIDDATA;
                 }
             }
         }
@@ -610,7 +621,7 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx)
                     if (cbpc < 0) {
                         av_log(s->avctx, AV_LOG_ERROR,
                                "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
-                        return -1;
+                        return AVERROR_INVALIDDATA;
                     }
                 } while (cbpc == 8);
 
@@ -630,7 +641,7 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx)
                     if (dc < 0) {
                         av_log(s->avctx, AV_LOG_ERROR,
                                "DC corrupted at %d %d\n", s->mb_x, s->mb_y);
-                        return -1;
+                        return AVERROR_INVALIDDATA;
                     }
                     dir <<= 1;
                     if (dc_pred_dir)
@@ -682,7 +693,7 @@ try_again:
                 if (cbpc < 0) {
                     av_log(s->avctx, AV_LOG_ERROR,
                            "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
-                    return -1;
+                    return AVERROR_INVALIDDATA;
                 }
                 if (cbpc == 20)
                     goto try_again;
@@ -719,12 +730,20 @@ try_again:
                         ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
                         if (!s->mcsel) {
                             mx = ff_h263_decode_motion(s, pred_x, s->f_code);
-                            if (mx >= 0xffff)
-                                return -1;
+                            if (mx >= 0xffff) {
+                                av_log(s->avctx, AV_LOG_ERROR,
+                                       "16x16 motion decode failed with mx of "
+                                       "%#010x not < 0xffff\n", mx);
+                                return AVERROR_INVALIDDATA;
+                            }
 
                             my = ff_h263_decode_motion(s, pred_y, s->f_code);
-                            if (my >= 0xffff)
-                                return -1;
+                            if (my >= 0xffff) {
+                                av_log(s->avctx, AV_LOG_ERROR,
+                                       "16x16 motion decode failed with my of "
+                                       "%#010x not < 0xffff\n", my);
+                                return AVERROR_INVALIDDATA;
+                            }
                             s->current_picture.mb_type[xy] = MB_TYPE_16x16 |
                                                              MB_TYPE_L0;
                         } else {
@@ -750,12 +769,21 @@ try_again:
                         for (i = 0; i < 4; i++) {
                             int16_t *mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
                             mx = ff_h263_decode_motion(s, pred_x, s->f_code);
-                            if (mx >= 0xffff)
-                                return -1;
+                            if (mx >= 0xffff) {
+                                av_log(s->avctx, AV_LOG_ERROR,
+                                       "motion decode failed with mx of "
+                                       "%#010x not < 0xffff\n", mx);
+                                return AVERROR_INVALIDDATA;
+                            }
+
 
                             my = ff_h263_decode_motion(s, pred_y, s->f_code);
-                            if (my >= 0xffff)
-                                return -1;
+                            if (my >= 0xffff) {
+                                av_log(s->avctx, AV_LOG_ERROR,
+                                       "motion decode failed with my of "
+                                       "%#010x not < 0xffff\n", my);
+                                return AVERROR_INVALIDDATA;
+                            }
                             mot_val[0] = mx;
                             mot_val[1] = my;
                         }
@@ -796,7 +824,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count)
                 if (cbpy < 0) {
                     av_log(s->avctx, AV_LOG_ERROR,
                            "cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
-                    return -1;
+                    return AVERROR_INVALIDDATA;
                 }
 
                 s->cbp_table[xy]               |= cbpy << 2;
@@ -811,7 +839,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count)
                     if (cbpy < 0) {
                         av_log(s->avctx, AV_LOG_ERROR,
                                "I cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
-                        return -1;
+                        return AVERROR_INVALIDDATA;
                     }
 
                     if (s->cbp_table[xy] & 8)
@@ -824,7 +852,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count)
                         if (dc < 0) {
                             av_log(s->avctx, AV_LOG_ERROR,
                                    "DC corrupted at %d %d\n", s->mb_x, s->mb_y);
-                            return -1;
+                            return AVERROR_INVALIDDATA;
                         }
                         dir <<= 1;
                         if (dc_pred_dir)
@@ -843,7 +871,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count)
                     if (cbpy < 0) {
                         av_log(s->avctx, AV_LOG_ERROR,
                                "P cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
-                        return -1;
+                        return AVERROR_INVALIDDATA;
                     }
 
                     if (s->cbp_table[xy] & 8)
@@ -877,14 +905,15 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
     if (mb_num < 0) {
         ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
                         s->mb_x, s->mb_y, part_a_error);
-        return -1;
+        av_log(s->avctx, AV_LOG_ERROR, "failed to decode partition A\n");
+        return AVERROR_INVALIDDATA;
     }
 
     if (s->resync_mb_x + s->resync_mb_y * s->mb_width + mb_num > s->mb_num) {
         av_log(s->avctx, AV_LOG_ERROR, "slice below monitor ...\n");
         ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
                         s->mb_x, s->mb_y, part_a_error);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     s->mb_num_left = mb_num;
@@ -896,7 +925,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
             av_log(s->avctx, AV_LOG_ERROR,
                    "marker missing after first I partition at %d %d\n",
                    s->mb_x, s->mb_y);
-            return -1;
+            return AVERROR_INVALIDDATA;
         }
     } else {
         while (show_bits(&s->gb, 10) == 1)
@@ -905,17 +934,19 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
             av_log(s->avctx, AV_LOG_ERROR,
                    "marker missing after first P partition at %d %d\n",
                    s->mb_x, s->mb_y);
-            return -1;
+            return AVERROR_INVALIDDATA;
         }
     }
     ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
                     s->mb_x - 1, s->mb_y, part_a_end);
 
     if (mpeg4_decode_partition_b(s, mb_num) < 0) {
-        if (s->pict_type == AV_PICTURE_TYPE_P)
+        if (s->pict_type == AV_PICTURE_TYPE_P) {
             ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
                             s->mb_x, s->mb_y, ER_DC_ERROR);
-        return -1;
+        }
+        av_log(s->avctx, AV_LOG_ERROR, "failed to decode partition B\n");
+        return AVERROR_INVALIDDATA;
     } else {
         if (s->pict_type == AV_PICTURE_TYPE_P)
             ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
@@ -952,8 +983,11 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
                 dc_pred_dir = (s->pred_dir_table[s->mb_x + s->mb_y * s->mb_stride] << n) & 32;
             } else {
                 level = mpeg4_decode_dc(s, n, &dc_pred_dir);
-                if (level < 0)
-                    return -1;
+                if (level < 0) {
+                    av_log(s->avctx, AV_LOG_ERROR,
+                           "failed to decode dc value\n");
+                    return AVERROR_INVALIDDATA;
+                }
             }
             block[0] = level;
             i        = 0;
@@ -1021,7 +1055,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
                     if (SHOW_UBITS(re, &s->gb, 1) == 0) {
                         av_log(s->avctx, AV_LOG_ERROR,
                                "1. marker bit missing in rvlc esc\n");
-                        return -1;
+                        return AVERROR_INVALIDDATA;
                     }
                     SKIP_CACHE(re, &s->gb, 1);
 
@@ -1034,7 +1068,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
                     if (SHOW_UBITS(re, &s->gb, 1) == 0) {
                         av_log(s->avctx, AV_LOG_ERROR,
                                "2. marker bit missing in rvlc esc\n");
-                        return -1;
+                        return AVERROR_INVALIDDATA;
                     }
                     SKIP_CACHE(re, &s->gb, 1);
 
@@ -1043,7 +1077,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
 
                     if (SHOW_UBITS(re, &s->gb, 5) != 0x10) {
                         av_log(s->avctx, AV_LOG_ERROR, "reverse esc missing\n");
-                        return -1;
+                        return AVERROR_INVALIDDATA;
                     }
                     SKIP_CACHE(re, &s->gb, 5);
 
@@ -1078,7 +1112,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
                                 if (SHOW_UBITS(re, &s->gb, 1) == 0) {
                                     av_log(s->avctx, AV_LOG_ERROR,
                                            "1. marker bit missing in 3. esc\n");
-                                    return -1;
+                                    return AVERROR_INVALIDDATA;
                                 }
                                 SKIP_CACHE(re, &s->gb, 1);
 
@@ -1088,7 +1122,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
                                 if (SHOW_UBITS(re, &s->gb, 1) == 0) {
                                     av_log(s->avctx, AV_LOG_ERROR,
                                            "2. marker bit missing in 3. esc\n");
-                                    return -1;
+                                    return AVERROR_INVALIDDATA;
                                 }
 
                                 SKIP_COUNTER(re, &s->gb, 1 + 12 + 1);
@@ -1105,7 +1139,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
                                         av_log(s->avctx, AV_LOG_ERROR,
                                                "|level| overflow in 3. esc, qp=%d\n",
                                                s->qscale);
-                                        return -1;
+                                        return AVERROR_INVALIDDATA;
                                     }
                                 }
                                 level = level < 0 ? -2048 : 2047;
@@ -1142,7 +1176,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
                 if (i & (~63)) {
                     av_log(s->avctx, AV_LOG_ERROR,
                            "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
-                    return -1;
+                    return AVERROR_INVALIDDATA;
                 }
 
                 block[scan_table[i]] = level;
@@ -1237,7 +1271,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
                 av_log(s->avctx, AV_LOG_ERROR,
                        "texture corrupted at %d %d %d\n",
                        s->mb_x, s->mb_y, s->mb_intra);
-                return -1;
+                return AVERROR_INVALIDDATA;
             }
             cbp += cbp;
         }
@@ -1304,7 +1338,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
             if (cbpc < 0) {
                 av_log(s->avctx, AV_LOG_ERROR,
                        "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
+                return AVERROR_INVALIDDATA;
             }
         } while (cbpc == 20);
 
@@ -1354,12 +1388,20 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
 
                 for (i = 0; i < 2; i++) {
                     mx = ff_h263_decode_motion(s, pred_x, s->f_code);
-                    if (mx >= 0xffff)
-                        return -1;
+                    if (mx >= 0xffff) {
+                        av_log(s->avctx, AV_LOG_ERROR,
+                               "16x8 motion decode failed with mx of "
+                               "%#010x not < 0xffff\n", mx);
+                        return AVERROR_INVALIDDATA;
+                    }
 
                     my = ff_h263_decode_motion(s, pred_y / 2, s->f_code);
-                    if (my >= 0xffff)
-                        return -1;
+                    if (my >= 0xffff) {
+                        av_log(s->avctx, AV_LOG_ERROR,
+                               "16x8 motion decode failed with my of "
+                               "%#010x not < 0xffff\n", my);
+                        return AVERROR_INVALIDDATA;
+                    }
 
                     s->mv[0][i][0] = mx;
                     s->mv[0][i][1] = my;
@@ -1371,13 +1413,21 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
                 ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
                 mx = ff_h263_decode_motion(s, pred_x, s->f_code);
 
-                if (mx >= 0xffff)
-                    return -1;
+                if (mx >= 0xffff) {
+                    av_log(s->avctx, AV_LOG_ERROR,
+                           "16x16 motion decode failed with mx of "
+                           "%#010x not < 0xffff\n", mx);
+                    return AVERROR_INVALIDDATA;
+                }
 
                 my = ff_h263_decode_motion(s, pred_y, s->f_code);
 
-                if (my >= 0xffff)
-                    return -1;
+                if (my >= 0xffff) {
+                    av_log(s->avctx, AV_LOG_ERROR,
+                           "16x8 motion decode failed with my of "
+                           "%#010x not < 0xffff\n", my);
+                    return AVERROR_INVALIDDATA;
+                }
                 s->mv[0][0][0] = mx;
                 s->mv[0][0][1] = my;
             }
@@ -1387,12 +1437,20 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
             for (i = 0; i < 4; i++) {
                 mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
                 mx      = ff_h263_decode_motion(s, pred_x, s->f_code);
-                if (mx >= 0xffff)
-                    return -1;
+                if (mx >= 0xffff) {
+                    av_log(s->avctx, AV_LOG_ERROR,
+                           "8x8 motion decode failed with mx of "
+                           "%#010x not < 0xffff\n", mx);
+                    return AVERROR_INVALIDDATA;
+                }
 
                 my = ff_h263_decode_motion(s, pred_y, s->f_code);
-                if (my >= 0xffff)
-                    return -1;
+                if (my >= 0xffff) {
+                    av_log(s->avctx, AV_LOG_ERROR,
+                           "8x8 motion decode failed with my of "
+                           "%#010x not < 0xffff\n", my);
+                    return AVERROR_INVALIDDATA;
+                }
                 s->mv[0][i][0] = mx;
                 s->mv[0][i][1] = my;
                 mot_val[0]     = mx;
@@ -1447,8 +1505,9 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
             modb2   = get_bits1(&s->gb);
             mb_type = get_vlc2(&s->gb, mb_type_b_vlc.table, MB_TYPE_B_VLC_BITS, 1);
             if (mb_type < 0) {
-                av_log(s->avctx, AV_LOG_ERROR, "illegal MB_type\n");
-                return -1;
+                av_log(s->avctx, AV_LOG_ERROR,
+                       "illegal MB_type (%d)\n", mb_type);
+                return AVERROR_INVALIDDATA;
             }
             mb_type = mb_type_b_map[mb_type];
             if (modb2) {
@@ -1559,7 +1618,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
             if (cbpc < 0) {
                 av_log(s->avctx, AV_LOG_ERROR,
                        "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
+                return AVERROR_INVALIDDATA;
             }
         } while (cbpc == 8);
 
@@ -1577,7 +1636,7 @@ intra:
         if (cbpy < 0) {
             av_log(s->avctx, AV_LOG_ERROR,
                    "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
+            return AVERROR_INVALIDDATA;
         }
         cbp = (cbpc & 3) | (cbpy << 2);
 
@@ -1593,7 +1652,7 @@ intra:
         /* decode each block */
         for (i = 0; i < 6; i++) {
             if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, 1, 0) < 0)
-                return -1;
+                return AVERROR_INVALIDDATA;
             cbp += cbp;
         }
         goto end;
@@ -1602,7 +1661,7 @@ intra:
     /* decode each block */
     for (i = 0; i < 6; i++) {
         if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, 0, 0) < 0)
-            return -1;
+            return AVERROR_INVALIDDATA;
         cbp += cbp;
     }
 
@@ -1726,7 +1785,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
     s->avctx->framerate.num = get_bits(gb, 16);
     if (!s->avctx->framerate.num) {
         av_log(s->avctx, AV_LOG_ERROR, "framerate==0\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     ctx->time_increment_bits = av_log2(s->avctx->framerate.num - 1) + 1;
@@ -1790,7 +1849,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
                        "%d sprite_warping_points\n",
                        ctx->num_sprite_warping_points);
                 ctx->num_sprite_warping_points = 0;
-                return -1;
+                return AVERROR_INVALIDDATA;
             }
             s->sprite_warping_accuracy  = get_bits(gb, 2);
             ctx->sprite_brightness_change = get_bits1(gb);
@@ -2237,7 +2296,8 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
         if (s->qscale == 0) {
             av_log(s->avctx, AV_LOG_ERROR,
                    "Error, header damaged or not MPEG4 header (qscale=0)\n");
-            return -1;  // makes no sense to continue, as there is nothing left from the image then
+            /* It now makes no sense to continue, as there is nothing left from the image. */
+            return AVERROR_INVALIDDATA;
         }
 
         if (s->pict_type != AV_PICTURE_TYPE_I) {
@@ -2245,7 +2305,8 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
             if (s->f_code == 0) {
                 av_log(s->avctx, AV_LOG_ERROR,
                        "Error, header damaged or not MPEG4 header (f_code=0)\n");
-                return -1;  // makes no sense to continue, as there is nothing left from the image then
+                /* It now makes no sense to continue, as there is nothing left from the image. */
+                return AVERROR_INVALIDDATA;
             }
         } else
             s->f_code = 1;
@@ -2333,8 +2394,11 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
                 (ctx->divx_version >= 0 || ctx->xvid_build >= 0)) {
                 av_log(s->avctx, AV_LOG_WARNING, "frame skip %d\n", gb->size_in_bits);
                 return FRAME_SKIPPED;  // divx bug
-            } else
-                return -1;  // end of stream
+            } else {
+                av_log(s->avctx, AV_LOG_ERROR,
+                       "encountered eos decoding picture header\n");
+                return AVERROR_EOF;  // end of stream
+            }
         }
 
         /* use the bits after the test */
@@ -2404,8 +2468,11 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
         }
 
         if (startcode >= 0x120 && startcode <= 0x12F) {
-            if (decode_vol_header(ctx, gb) < 0)
-                return -1;
+            if (decode_vol_header(ctx, gb) < 0) {
+                av_log(s->avctx, AV_LOG_ERROR,
+                       "failed to decode volume header\n");
+                return AVERROR_INVALIDDATA;
+            }
         } else if (startcode == USER_DATA_STARTCODE) {
             decode_user_data(ctx, gb);
         } else if (startcode == GOP_STARTCODE) {
-- 
2.5.0



More information about the libav-devel mailing list