summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2014-08-19 14:05:56 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-21 17:59:06 +0200
commit4a5cc34b46a8bf8d47ec907383be83b6153b9f69 (patch)
tree73162f617164d2cb3edb308717b2b9ece34bcc13 /libavcodec
parenta9f3bb14ba8b303cf87c42b8fe7e423571176d54 (diff)
wavpackenc: assert on too small buffer
bytestream2_* will not cause buffer overflow, but in that case, this means the allocation would be incorrect and the encoded result invalid. Therefore, assert no overflow occurred. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/wavpackenc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index 005cf7c2e5..3631a0819f 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -2813,6 +2813,8 @@ static int wavpack_encode_block(WavPackEncodeContext *s,
block_size = bytestream2_tell_p(&pb);
AV_WL32(out + 4, block_size - 8);
+ av_assert0(put_bits_left(&s->pb) > 0);
+
return block_size;
}