Commit c0fc83ed authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mlz: Check offset before writing

Fixes: 0cee183a09bff5aa5108429717c35a4d/asan_heap-oob_1d99eca_3702_9ef60e80de79082a778d3d9ce8ef3b64.mp4
Affects no release

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2f7a12fa
...@@ -81,6 +81,10 @@ static int decode_string(MLZ* mlz, unsigned char *buff, int string_code, int *fi ...@@ -81,6 +81,10 @@ static int decode_string(MLZ* mlz, unsigned char *buff, int string_code, int *fi
} else { } else {
offset = dict[current_code].match_len - 1; offset = dict[current_code].match_len - 1;
tmp_code = dict[current_code].char_code; tmp_code = dict[current_code].char_code;
if (offset >= bufsize) {
av_log(mlz->context, AV_LOG_ERROR, "MLZ offset error.\n");
return count;
}
buff[offset] = tmp_code; buff[offset] = tmp_code;
count++; count++;
} }
......
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