[FFmpeg-cvslog] mlp_parser: Fix infinite loop with 0 bytes_left.
Michael Niedermayer
git at videolan.org
Fri Dec 30 23:03:32 CET 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Dec 29 21:26:30 2011 +0100| [e146ad95d79b1a6e6b9e566366b832825c79679f] | committer: Michael Niedermayer
mlp_parser: Fix infinite loop with 0 bytes_left.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e146ad95d79b1a6e6b9e566366b832825c79679f
---
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..f31e2d5 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) { // prevent infinite loop
+ goto lost_sync;
+ }
mp->bytes_left -= mp->pc.index;
}
More information about the ffmpeg-cvslog
mailing list