diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-16 18:09:16 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-16 19:19:35 +0100 |
commit | 211200e0c0efa48b2815ce93fda10dab43526d1b (patch) | |
tree | 197c8011be14a8ccd2ae239866aeb71a6a23903e /libavcodec/xface.c | |
parent | 93a5a16f136d095d23610f57bdad10ba88120fba (diff) | |
download | ffmpeg-211200e0c0efa48b2815ce93fda10dab43526d1b.tar.gz |
avcodec/xface: Add asserts to limit nb_words from becoming too large
Approved-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/xface.c')
-rw-r--r-- | libavcodec/xface.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/xface.c b/libavcodec/xface.c index 0ebf2f2ec0..8c0cbfdb84 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; } |