summaryrefslogtreecommitdiff
path: root/libavcodec/flac.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2005-02-20 23:21:50 +0000
committerLoren Merritt <lorenm@u.washington.edu>2005-02-20 23:21:50 +0000
commit09f20d37867baaa0122ffdd75f0481b2b3a08079 (patch)
tree8113848658b96d4838ab8c8bffcfebd0670ccfa6 /libavcodec/flac.c
parentd6c80d3633b9fe1d0470ab2e060c050a167cfa42 (diff)
downloadffmpeg-09f20d37867baaa0122ffdd75f0481b2b3a08079.tar.gz
Fix a crash when multiple metadata packets are present.
Originally committed as revision 3965 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flac.c')
-rw-r--r--libavcodec/flac.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index c308133cd6..a640b900b4 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -591,12 +591,12 @@ static int flac_decode_frame(AVCodecContext *avctx,
int16_t *samples = data;
if(s->max_framesize == 0){
- s->max_framesize= 8192; // should hopefully be enough for the first header
+ s->max_framesize= 65536; // should hopefully be enough for the first header
s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
}
if(1 && s->max_framesize){//FIXME truncated
- buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
+ buf_size= FFMAX(FFMIN(buf_size, s->max_framesize - s->bitstream_size), 0);
input_buf_size= buf_size;
if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
@@ -638,9 +638,6 @@ static int flac_decode_frame(AVCodecContext *avctx,
int bits_count= get_bits_count(&s->gb);
metadata_streaminfo(s);
- buf= &s->bitstream[s->bitstream_index];
- init_get_bits(&s->gb, buf, buf_size*8);
- skip_bits(&s->gb, bits_count);
dump_headers(s);
break;}