aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/smacker.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-29 03:55:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-29 03:56:26 +0200
commita3539d26eceebe69d890ad39e2ab0dcc19433246 (patch)
tree7ec11a6b7101dbb1876a6d9c43229a919fec70a9 /libavformat/smacker.c
parent7118358a950e20a4439d796f16892b27dad6c754 (diff)
parent4ff5167ee7fdee6d35c1bb2558172329ae6ec770 (diff)
downloadffmpeg-a3539d26eceebe69d890ad39e2ab0dcc19433246.tar.gz
Merge commit '4ff5167ee7fdee6d35c1bb2558172329ae6ec770' into release/0.10
* commit '4ff5167ee7fdee6d35c1bb2558172329ae6ec770': wmapro: make sure there is room to store the current packet lavc: move put_bits_left in put_bits.h 4xm: do not overread the source buffer in decode_p_block 4xm: check bitstream_size boundary before using it 4xm: reject frames not compatible with the declared version 4xm: use the correct logging context 4xm: check the return value of read_huffman_tables(). 4xm: don't rely on get_buffer() initializing the frame. vmdav: convert to bytestream2 smacker: check frame size validity smacker: pad the extradata allocation smacker: check the return value of smacker_decode_tree smacker: fix an off by one in huff.length computation Prepare for 0.8.8 Release tiff: do not overread the source buffer apetag: use int64_t for filesize wavpack: return meaningful errors Conflicts: RELEASE libavcodec/4xm.c libavcodec/vmdav.c libavformat/smacker.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/smacker.c')
-rw-r--r--libavformat/smacker.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 2385088200..9f8fbf5308 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -203,7 +203,8 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* load trees to extradata, they will be unpacked by decoder */
- st->codec->extradata = av_malloc(smk->treesize + 16);
+ st->codec->extradata = av_mallocz(smk->treesize + 16 +
+ FF_INPUT_BUFFER_PADDING_SIZE);
st->codec->extradata_size = smk->treesize + 16;
if(!st->codec->extradata){
av_log(s, AV_LOG_ERROR, "Cannot allocate %i bytes of extradata\n", smk->treesize + 16);
@@ -298,12 +299,14 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
/* if audio chunks are present, put them to stack and retrieve later */
for(i = 0; i < 7; i++) {
if(flags & 1) {
- unsigned int size;
+ uint32_t size;
uint8_t *tmpbuf;
size = avio_rl32(s->pb) - 4;
- if(size + 4L > frame_size)
+ if (!size || size + 4L > frame_size) {
+ av_log(s, AV_LOG_ERROR, "Invalid audio part size\n");
return AVERROR_INVALIDDATA;
+ }
frame_size -= size;
frame_size -= 4;
smk->curstream++;