]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vp9_parser.c
Merge commit '4dfbc7a7559ccab666a8fd39de4224eb4b02c768'
[ffmpeg] / libavcodec / vp9_parser.c
index f1f7e350d26b14192219ead64dd7c7664c149c70..2e9235e6570ff690a4401285044d106526be6285 100644 (file)
@@ -64,7 +64,7 @@ static int parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size)
         if (ctx->pts == AV_NOPTS_VALUE)
             ctx->pts = s->pts;
         s->pts = AV_NOPTS_VALUE;
-    } else {
+    } else if (ctx->pts != AV_NOPTS_VALUE) {
         s->pts = ctx->pts;
         ctx->pts = AV_NOPTS_VALUE;
     }
@@ -111,12 +111,12 @@ static int parse(AVCodecParserContext *ctx,
                 while (n_frames--) { \
                     unsigned sz = rd; \
                     idx += a; \
-                    if (sz > size) { \
+                    if (sz == 0 || sz > size) { \
                         s->n_frames = 0; \
                         *out_size = size; \
                         *out_data = data; \
                         av_log(avctx, AV_LOG_ERROR, \
-                               "Superframe packet size too big: %u > %d\n", \
+                               "Invalid superframe packet size: %u frame size: %d\n", \
                                sz, size); \
                         return full_size; \
                     } \
@@ -132,7 +132,7 @@ static int parse(AVCodecParserContext *ctx,
                     size -= sz; \
                 } \
                 parse_frame(ctx, *out_data, *out_size); \
-                return *out_size
+                return s->n_frames > 0 ? *out_size : full_size
 
                 case_n(1, *idx);
                 case_n(2, AV_RL16(idx));