Commit f3296b94 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h264: Undefined behavior (left shift of 12852653 by 8 places cannot be...

avcodec/h264: Undefined behavior (left shift of 12852653 by 8 places cannot be represented in type 'int')

Fixes: asan_heap-oob_84f75d_8_asan_heap-oob_a2a00a_341_mbc.ts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 344f8d30
...@@ -1358,7 +1358,7 @@ static int get_avc_nalsize(H264Context *h, const uint8_t *buf, ...@@ -1358,7 +1358,7 @@ static int get_avc_nalsize(H264Context *h, const uint8_t *buf,
return -1; return -1;
for (i = 0; i < h->nal_length_size; i++) for (i = 0; i < h->nal_length_size; i++)
nalsize = (nalsize << 8) | buf[(*buf_index)++]; nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
if (nalsize <= 0 || nalsize > buf_size - *buf_index) { if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
av_log(h->avctx, AV_LOG_ERROR, av_log(h->avctx, AV_LOG_ERROR,
"AVC: nal size %d\n", nalsize); "AVC: nal size %d\n", nalsize);
......
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