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 <michael@niedermayer.cc>
1 parent 20182e7 commit 25ab1a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libavcodec/dvdsubdec.c

Lines changed: 2 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy