Browse code

Fail RLE decoding if insufficient data for a complete bitmap was decoded.

Originally committed as revision 25797 to svn://svn.ffmpeg.org/ffmpeg/trunk

Reimar Döffinger authored on 2010/11/23 05:39:18
Showing 1 changed files
... ...
@@ -136,6 +136,11 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub,
136 136
         }
137 137
     }
138 138
 
139
+    if (pixel_count < sub->rects[0]->w * sub->rects[0]->h) {
140
+        av_log(avctx, AV_LOG_ERROR, "Insufficient RLE data for subtitle\n");
141
+        return -1;
142
+    }
143
+
139 144
     dprintf(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h);
140 145
 
141 146
     return 0;