avcodec/dnxhd_parser: Fix parser when input does not have nicely sized packets
[ffmpeg.git] / libavcodec / dnxhd_parser.c
index 31a3158..63b4ff8 100644 (file)
@@ -79,8 +79,9 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
                     if (remaining <= 0)
                         continue;
                 }
+                remaining += i - 47;
                 dctx->remaining = remaining;
-                if (buf_size - i + 47 >= dctx->remaining) {
+                if (buf_size >= dctx->remaining) {
                     pc->frame_start_found = 0;
                     pc->state64 = -1;
                     dctx->cur_byte = 0;