1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

shorten: Fix signedness of comparission

Fixes out of array accessed

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-02-19 23:06:40 +01:00
parent ce153eef8f
commit a5153b1d16

View File

@ -349,7 +349,7 @@ static int read_header(ShortenContext *s)
int skip_bytes, blocksize; int skip_bytes, blocksize;
blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE)); blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
if (!blocksize || blocksize > MAX_BLOCKSIZE) { if (!blocksize || blocksize > (unsigned)MAX_BLOCKSIZE) {
av_log(s->avctx, AV_LOG_ERROR, "invalid or unsupported block size: %d\n", av_log(s->avctx, AV_LOG_ERROR, "invalid or unsupported block size: %d\n",
blocksize); blocksize);
return AVERROR(EINVAL); return AVERROR(EINVAL);
@ -499,7 +499,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n"); av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n");
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
if (!blocksize || blocksize > MAX_BLOCKSIZE) { if (!blocksize || blocksize > (unsigned)MAX_BLOCKSIZE) {
av_log(avctx, AV_LOG_ERROR, "invalid or unsupported " av_log(avctx, AV_LOG_ERROR, "invalid or unsupported "
"block size: %d\n", blocksize); "block size: %d\n", blocksize);
return AVERROR(EINVAL); return AVERROR(EINVAL);