summaryrefslogtreecommitdiff
path: root/libavcodec/wavpack.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@via.ecp.fr>2009-05-03 05:42:51 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2009-05-03 05:42:51 +0000
commit66311f86d4dec618eeab5af36e96408eb16cd6a5 (patch)
tree111500d61bcc288eb63124ee6b8458ffd16287d7 /libavcodec/wavpack.c
parent241f5eab32fc8e22fecbf1a1c3c2d0d878d1b352 (diff)
Check whether extra bits block has enough data.
Patch by Laurent Aimar "f\145nr\151r >at< vide\157lan <dot> o\162g" Originally committed as revision 18732 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r--libavcodec/wavpack.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index c8ab858439..544ed9649e 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -795,6 +795,14 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
return -1;
}
+ if(s->got_extra_bits){
+ const int size = s->gb_extra_bits.size_in_bits - get_bits_count(&s->gb_extra_bits);
+ const int wanted = s->samples * s->extra_bits << s->stereo_in;
+ if(size < wanted){
+ av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n");
+ s->got_extra_bits = 0;
+ }
+ }
if(s->stereo_in){
if(bpp == 2)