summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cadhalpun <andreas.cadhalpun@googlemail.com>2017-01-31 01:59:38 +0100
committerDiego Biurrun <diego@biurrun.de>2017-01-31 09:35:54 +0100
commit612cc0712836af2f025b0c68b11da29b9f259d5a (patch)
treee5f8375e6093ed5e3545a7d55f9407e7471f3045
parent708e84cda1bdbffb92847f3d6ccf6fbeb26d9948 (diff)
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@googlemail.com> Signed-off-by: Diego Biurrun <diego@biurrun.de>
-rw-r--r--libavcodec/pgssubdec.c5
1 files changed, 4 insertions, 1 deletions
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;