dvdsubdec: validate offset2 similar to offset1
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tue, 10 Nov 2015 21:14:39 +0000 (22:14 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tue, 10 Nov 2015 23:39:47 +0000 (00:39 +0100)
If it is negative, it causes segmentation faults in decode_rle.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavcodec/dvdsubdec.c

index ee06d55..014b0a3 100644 (file)
@@ -353,7 +353,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
             }
         }
     the_end:
-        if (offset1 >= 0) {
+        if (offset1 >= 0 && offset2 >= 0) {
             int w, h;
             uint8_t *bitmap;