[FFmpeg-cvslog] avcodec/flacdec: Check for invalid vlcs

Michael Niedermayer git at videolan.org
Sat Feb 4 03:26:58 EET 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Dec  9 16:29:35 2016 +0100| [fd00203554334f602ee1d7c5416ff25f356f4fb7] | committer: Michael Niedermayer

avcodec/flacdec: Check for invalid vlcs

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index af81115..0fffc2d 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -259,7 +259,13 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
                 *decoded++ = get_sbits_long(&s->gb, tmp);
         } else {
             for (; i < samples; i++) {
-                *decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
+                int v = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
+                if (v == 0x80000000){
+                    av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n");
+                    return AVERROR_INVALIDDATA;
+                }
+
+                *decoded++ = v;
             }
         }
         i= 0;



More information about the ffmpeg-cvslog mailing list