summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-10-26 16:29:57 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-10-26 18:46:10 +0200
commit25ab1a65f3acb5ec67b53fb7a2463a7368f1ad16 (patch)
treed268219c43290bfb7c48d40355109a32f7ac7618 /libavcodec
parent20182e79f9c23798f9ee01bdfd6f670d3aa225a9 (diff)
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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dvdsubdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index b81b481e43..6cb612bb95 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -548,7 +548,8 @@ static int append_to_cached_buf(AVCodecContext *avctx,
{
DVDSubContext *ctx = avctx->priv_data;
- if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
+ av_assert0(buf_size >= 0 && ctx->buf_size <= sizeof(ctx->buf));
+ if (buf_size >= sizeof(ctx->buf) - ctx->buf_size) {
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
"too large SPU packets aborted.\n");
ctx->buf_size = 0;