[FFmpeg-cvslog] avcodec/xface: Add asserts to limit nb_words from becoming too large
Michael Niedermayer
git at videolan.org
Mon Dec 22 03:32:50 CET 2014
ffmpeg | branch: release/2.5 | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 16 18:09:16 2014 +0100| [71b1abe6385601a7ef2a797c8e659f388a247dc3] | committer: Michael Niedermayer
avcodec/xface: Add asserts to limit nb_words from becoming too large
Approved-by: Stefano Sabatini <stefasab at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 211200e0c0efa48b2815ce93fda10dab43526d1b)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71b1abe6385601a7ef2a797c8e659f388a247dc3
---
libavcodec/xface.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/xface.c b/libavcodec/xface.c
index 0ebf2f2..8c0cbfd 100644
--- a/libavcodec/xface.c
+++ b/libavcodec/xface.c
@@ -24,6 +24,8 @@
* X-Face common data and utilities definition.
*/
+#include "libavutil/avassert.h"
+
#include "xface.h"
void ff_big_add(BigInt *b, uint8_t a)
@@ -43,6 +45,7 @@ void ff_big_add(BigInt *b, uint8_t a)
c >>= XFACE_BITSPERWORD;
}
if (i == b->nb_words && c) {
+ av_assert0(b->nb_words < XFACE_MAX_WORDS);
b->nb_words++;
*w = c & XFACE_WORDMASK;
}
@@ -98,6 +101,7 @@ void ff_big_mul(BigInt *b, uint8_t a)
return;
if (a == 0) {
/* treat this as a == WORDCARRY and just shift everything left a WORD */
+ av_assert0(b->nb_words < XFACE_MAX_WORDS);
i = b->nb_words++;
w = b->words + i;
while (i--) {
@@ -116,6 +120,7 @@ void ff_big_mul(BigInt *b, uint8_t a)
c >>= XFACE_BITSPERWORD;
}
if (c) {
+ av_assert0(b->nb_words < XFACE_MAX_WORDS);
b->nb_words++;
*w = c & XFACE_WORDMASK;
}
More information about the ffmpeg-cvslog
mailing list