avcodec/on2avc: reject subframe count whose * SUBFRAME_SIZE product overflows 32-bit
Found-by: Anthropic agents; validated and reported by Ada Logics. Signed-off-by: David Korczynski <david@adalogics.com>
This commit is contained in:
committed by
michaelni
parent
2576e09434
commit
331b3e9dea
@@ -866,6 +866,12 @@ static int on2avc_decode_frame(AVCodecContext * avctx, AVFrame *frame,
|
|||||||
av_log(avctx, AV_LOG_ERROR, "No subframes present\n");
|
av_log(avctx, AV_LOG_ERROR, "No subframes present\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
if (num_frames > INT_MAX / ON2AVC_SUBFRAME_SIZE) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
|
"Too many subframes (%d); per-frame sample count overflows\n",
|
||||||
|
num_frames);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
/* get output buffer */
|
/* get output buffer */
|
||||||
frame->nb_samples = ON2AVC_SUBFRAME_SIZE * num_frames;
|
frame->nb_samples = ON2AVC_SUBFRAME_SIZE * num_frames;
|
||||||
|
|||||||
Reference in New Issue
Block a user