Reference: ETSI EN 300 743 V1.2.1 7.2.2 Region composition segment
Fixes: Timeout
Fixes: 13325/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-5143979392237568
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a8c5ae451184e879fc8ff1333c6f26f9542c8ebf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -1242,6 +1242,13 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx, |
1242 | 1242 |
display->y_pos = AV_RB16(buf) & 0xfff; |
1243 | 1243 |
buf += 2; |
1244 | 1244 |
|
1245 |
+ if (display->x_pos >= region->width || |
|
1246 |
+ display->y_pos >= region->height) { |
|
1247 |
+ av_log(avctx, AV_LOG_ERROR, "Object outside region\n"); |
|
1248 |
+ av_free(display); |
|
1249 |
+ return AVERROR_INVALIDDATA; |
|
1250 |
+ } |
|
1251 |
+ |
|
1245 | 1252 |
if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) { |
1246 | 1253 |
display->fgcolor = *buf++; |
1247 | 1254 |
display->bgcolor = *buf++; |