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>
Thu, 26 Nov 2015 00:38:18 +0000 (01:38 +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>
(cherry picked from commit f621749d1181987b3f815c6766ea66d6c5d55198)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavcodec/dvdsubdec.c

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