avformat/avs: Check if return code is representable

Fixes: leak
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-6738814988320768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 52d666edec)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-09-20 01:32:56 +02:00
parent 43c3acb60e
commit d8220c4c08
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 4 additions and 0 deletions

View File

@ -141,6 +141,10 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
return 0; /* this indicate EOS */
if (ret < 0)
return ret;
if (size != (int)size) {
av_packet_unref(pkt);
return AVERROR(EDOM);
}
pkt->stream_index = avs->st_audio->index;
pkt->flags |= AV_PKT_FLAG_KEY;