[FFmpeg-cvslog] vqavideo: check chunk sizes before reading chunks
Michael Niedermayer
git at videolan.org
Mon Mar 10 18:12:02 CET 2014
ffmpeg | branch: release/0.10 | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 25 06:11:59 2013 +0100| [d04194db45711f82e3e87fab62c9224ac03998c3] | committer: Reinhard Tartler
vqavideo: check chunk sizes before reading chunks
Fixes out of array writes
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit ab6c9332bfa1e20127a16392a0b85a4aa4840889)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 13093f9767b922661132a3c1f4b5ba2c7338b660)
CC: libav-stable at libav.org
Signed-off-by: Reinhard Tartler <siretart at tauware.de>
(cherry picked from commit f7d18deb73d1dd1b27b2c7062c9a10d168a6c62a)
Addresses: CVE-2013-0865
Signed-off-by: Reinhard Tartler <siretart at tauware.de>
(cherry picked from commit ab434bf0d051008a329d49d0256faa5d64e2bf4d)
Signed-off-by: Reinhard Tartler <siretart at tauware.de>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d04194db45711f82e3e87fab62c9224ac03998c3
---
libavcodec/vqavideo.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index 110d8b1..7870f0e 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -533,6 +533,12 @@ static int vqa_decode_chunk(VqaContext *s)
bytestream2_seek(&s->gb, cbp0_chunk, SEEK_SET);
chunk_size = bytestream2_get_be32(&s->gb);
+ if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
+ av_log(s->avctx, AV_LOG_ERROR, "cbp0 chunk too large (%u bytes)\n",
+ chunk_size);
+ return AVERROR_INVALIDDATA;
+ }
+
/* accumulate partial codebook */
bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
chunk_size);
@@ -556,6 +562,12 @@ static int vqa_decode_chunk(VqaContext *s)
bytestream2_seek(&s->gb, cbpz_chunk, SEEK_SET);
chunk_size = bytestream2_get_be32(&s->gb);
+ if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
+ av_log(s->avctx, AV_LOG_ERROR, "cbpz chunk too large (%u bytes)\n",
+ chunk_size);
+ return AVERROR_INVALIDDATA;
+ }
+
/* accumulate partial codebook */
bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
chunk_size);
More information about the ffmpeg-cvslog
mailing list