Commit 1e33035e authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

proresdec_lgpl: explicitly check coff[3] against slice_data_size

The implicit checks via v_data_size and a_data_size don't work in the case
'(hdr_size > 7) && !ctx->alpha_info'.

This fixes segmentation faults due to invalid reads.

This problem was introduced in commit
547c2f00.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 18108f36
......@@ -625,7 +625,7 @@ static int decode_slice(AVCodecContext *avctx, void *tdata)
/* if V or alpha component size is negative that means that previous
component sizes are too large */
if (v_data_size < 0 || a_data_size < 0 || hdr_size < 6) {
if (v_data_size < 0 || a_data_size < 0 || hdr_size < 6 || coff[3] > slice_data_size) {
av_log(avctx, AV_LOG_ERROR, "invalid data size\n");
return AVERROR_INVALIDDATA;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment