diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2017-01-31 01:55:44 +0100 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2017-02-01 02:21:28 +0100 |
commit | 842e98b4d83d8cf297e2bc2761f1f47eb89e49e4 (patch) | |
tree | bbb3fedd7a930d9063fa145d2b48a69971994a86 /libavcodec | |
parent | 536ac72f46b7b5094949b4e6a7e07cc8de86aac9 (diff) | |
download | ffmpeg-streaming-842e98b4d83d8cf297e2bc2761f1f47eb89e49e4.zip ffmpeg-streaming-842e98b4d83d8cf297e2bc2761f1f47eb89e49e4.tar.gz |
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.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pgssubdec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index b50b37b..b897d72 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -300,8 +300,11 @@ static int parse_object_segment(AVCodecContext *avctx, av_fast_padded_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; |