diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 67c7eef1b5..b902422b2b 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1456,6 +1456,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, buf_index = find_start_code(buf, buf_size, buf_index, next_avc); if (buf_index >= buf_size) break; + if (buf_index >= next_avc) + continue; } hx = h->thread_context[context_count];