mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
avcodec/xface: correct the XFACE_MAX_* values
Fixes out of array access Fixes: asan_stack-oob_32c12e5_2536_cov_2442316831_lena.xface Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
3030fb7e0d
commit
93a5a16f13
@ -41,17 +41,17 @@
|
|||||||
/*
|
/*
|
||||||
* Image is encoded as a big integer, using characters from '~' to
|
* Image is encoded as a big integer, using characters from '~' to
|
||||||
* '!', for a total of 94 symbols. In order to express
|
* '!', for a total of 94 symbols. In order to express
|
||||||
* 48x48*2=8*XFACE_MAX_WORDS=4608
|
* 48x48 pixels with the worst case encoding 666 symbols should
|
||||||
* bits, we need a total of 704 digits, as given by:
|
* be sufficient.
|
||||||
* ceil(lg_94(2^4608)) = 704
|
|
||||||
*/
|
*/
|
||||||
#define XFACE_MAX_DIGITS 704
|
#define XFACE_MAX_DIGITS 666
|
||||||
|
|
||||||
#define XFACE_BITSPERWORD 8
|
#define XFACE_BITSPERWORD 8
|
||||||
#define XFACE_WORDCARRY (1 << XFACE_BITSPERWORD)
|
#define XFACE_WORDCARRY (1 << XFACE_BITSPERWORD)
|
||||||
#define XFACE_WORDMASK (XFACE_WORDCARRY - 1)
|
#define XFACE_WORDMASK (XFACE_WORDCARRY - 1)
|
||||||
|
|
||||||
#define XFACE_MAX_WORDS ((XFACE_PIXELS * 2 + XFACE_BITSPERWORD - 1) / XFACE_BITSPERWORD)
|
// This must be larger or equal to log256(94^XFACE_MAX_DIGITS)
|
||||||
|
#define XFACE_MAX_WORDS 546
|
||||||
|
|
||||||
/* Portable, very large unsigned integer arithmetic is needed.
|
/* Portable, very large unsigned integer arithmetic is needed.
|
||||||
* Implementation uses arrays of WORDs. */
|
* Implementation uses arrays of WORDs. */
|
||||||
|
Loading…
Reference in New Issue
Block a user