mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-11 08:13:06 +00:00
avcodec/dvdsub_parser: Fix buf_size check
Fixes: signed integer overflow Fixes: out of array access Fixes: dvdsub_int_overflow_mixed_ps.mpg Found-by: Quang Luong of Calif.io in collaboration with OpenAI Codex Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
michaelni
parent
9d97771bc6
commit
1bde76da89
@@ -60,7 +60,7 @@ static int dvdsub_parse(AVCodecParserContext *s,
|
||||
pc->packet = av_malloc(pc->packet_len + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
}
|
||||
if (pc->packet) {
|
||||
if (pc->packet_index + buf_size <= pc->packet_len) {
|
||||
if (buf_size <= pc->packet_len - pc->packet_index) {
|
||||
memcpy(pc->packet + pc->packet_index, buf, buf_size);
|
||||
pc->packet_index += buf_size;
|
||||
if (pc->packet_index >= pc->packet_len) {
|
||||
|
||||
Reference in New Issue
Block a user