[FFmpeg-cvslog] pgssubdec: reset rle_data_len/rle_remaining_len on allocation error

Andreas Cadhalpun git at videolan.org
Tue Sep 26 21:01:29 EEST 2017


ffmpeg | branch: master | Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> | Tue Jan 31 01:59:38 2017 +0100| [612cc0712836af2f025b0c68b11da29b9f259d5a] | committer: Diego Biurrun

pgssubdec: reset rle_data_len/rle_remaining_len on allocation error

The code relies on their validity and otherwise can try to access a NULL
object->rle pointer, causing segmentation faults.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Diego Biurrun <diego at biurrun.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=612cc0712836af2f025b0c68b11da29b9f259d5a
---

 libavcodec/pgssubdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 886685b4b5..a6a43ae32b 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -297,8 +297,11 @@ static int parse_object_segment(AVCodecContext *avctx,
 
     av_fast_malloc(&object->rle, &object->rle_buffer_size, rle_bitmap_len);
 
-    if (!object->rle)
+    if (!object->rle) {
+        object->rle_data_len      = 0;
+        object->rle_remaining_len = 0;
         return AVERROR(ENOMEM);
+    }
 
     memcpy(object->rle, buf, buf_size);
     object->rle_data_len = buf_size;



More information about the ffmpeg-cvslog mailing list