Skip to content

Commit 25ab1a6

Browse files
committed
avcodec/dvdsubdec: Fix buf_size check
Fixes out of array access Found-by: Thomas Garnier using libFuzzer Signed-off-by: Michael Niedermayer <[email protected]>
1 parent 20182e7 commit 25ab1a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libavcodec/dvdsubdec.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ static int append_to_cached_buf(AVCodecContext *avctx,
548548
{
549549
DVDSubContext *ctx = avctx->priv_data;
550550

551-
if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
551+
av_assert0(buf_size >= 0 && ctx->buf_size <= sizeof(ctx->buf));
552+
if (buf_size >= sizeof(ctx->buf) - ctx->buf_size) {
552553
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
553554
"too large SPU packets aborted.\n");
554555
ctx->buf_size = 0;

0 commit comments

Comments
 (0)