summaryrefslogtreecommitdiff
path: root/libavcodec/dvdsubdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/dvdsubdec.c')
-rw-r--r--libavcodec/dvdsubdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 13d52c8c68..632a53adab 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -125,6 +125,8 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h, uint8_t used_
len = decode_run_8bit(&gb, &color);
else
len = decode_run_2bit(&gb, &color);
+ if (len != INT_MAX && len > w - x)
+ return AVERROR_INVALIDDATA;
len = FFMIN(len, w - x);
memset(d + x, color, len);
used_color[color] = 1;