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>
(cherry picked from commit 842e98b4d8)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2017-01-31 01:55:44 +01:00
parent 6c96200ceb
commit f77bb85b08
1 changed files with 4 additions and 1 deletions

View File

@ -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;