[FFmpeg-devel] [PATCH 1/2] mlp_parser: Fix infinite loop with 0 bytes_left.

Michael Niedermayer michaelni at gmx.at
Thu Dec 29 22:40:15 CET 2011


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/mlp_parser.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 4ceea5e..96f5fae 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -263,6 +263,9 @@ static int mlp_parse(AVCodecParserContext *s,
         mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : buf[0]) << 8)
                        |  (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]);
         mp->bytes_left = (mp->bytes_left & 0xfff) * 2;
+        if (mp->bytes_left <= 0) {
+            goto lost_sync;
+        }
         mp->bytes_left -= mp->pc.index;
     }
 
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list