shorten: validate block size
This commit is contained in:
parent
45d7d31fb9
commit
cfa317f67d
@ -330,8 +330,16 @@ static int read_header(ShortenContext *s)
|
|||||||
|
|
||||||
/* get blocksize if version > 0 */
|
/* get blocksize if version > 0 */
|
||||||
if (s->version > 0) {
|
if (s->version > 0) {
|
||||||
int skip_bytes;
|
int skip_bytes, blocksize;
|
||||||
s->blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
|
|
||||||
|
blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
|
||||||
|
if (!blocksize || blocksize > MAX_BLOCKSIZE) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "invalid or unsupported block size: %d\n",
|
||||||
|
blocksize);
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
s->blocksize = blocksize;
|
||||||
|
|
||||||
maxnlpc = get_uint(s, LPCQSIZE);
|
maxnlpc = get_uint(s, LPCQSIZE);
|
||||||
s->nmean = get_uint(s, 0);
|
s->nmean = get_uint(s, 0);
|
||||||
|
|
||||||
@ -456,6 +464,11 @@ static int shorten_decode_frame(AVCodecContext *avctx,
|
|||||||
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) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "invalid or unsupported "
|
||||||
|
"block size: %d\n", blocksize);
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
s->blocksize = blocksize;
|
s->blocksize = blocksize;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user