[FFmpeg-cvslog] avcodec/flacdec: make while get_bits loop more robust by checking bits left

Michael Niedermayer git at videolan.org
Wed Oct 30 14:48:06 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Oct 30 14:23:30 2013 +0100| [9f5b75f2416cf8c9a1753159b65591c249006c33] | committer: Michael Niedermayer

avcodec/flacdec: make while get_bits loop more robust by checking bits left

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f5b75f2416cf8c9a1753159b65591c249006c33
---

 libavcodec/flacdec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 9bf950a..95623cb 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -366,8 +366,11 @@ static inline int decode_subframe(FLACContext *s, int channel)
                    bps, left);
             return AVERROR_INVALIDDATA;
         }
-        while (!get_bits1(&s->gb))
+        while (!get_bits1(&s->gb)) {
             wasted++;
+            if (get_bits_left(&s->gb) <= 0)
+                return AVERROR_INVALIDDATA;
+        }
         bps -= wasted;
     }
     if (bps > 32) {



More information about the ffmpeg-cvslog mailing list