[FFmpeg-devel] [PATCH 1/2] avformat/vividas: Check packet size
Anton Khirnov
anton at khirnov.net
Wed Sep 28 18:16:05 EEST 2022
Quoting Michael Niedermayer (2022-09-22 20:08:51)
> Fixes: signed integer overflow: 119760682 - -2084600173 cannot be represented in type 'int'
> Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6745781167587328
>
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
> libavformat/vividas.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/vividas.c b/libavformat/vividas.c
> index e9954f73ed0..e8efe49a5c0 100644
> --- a/libavformat/vividas.c
> +++ b/libavformat/vividas.c
> @@ -683,6 +683,7 @@ static int viv_read_packet(AVFormatContext *s,
>
> if (viv->sb_entries[viv->current_sb_entry].flag == 0) {
> uint64_t v_size = ffio_read_varlen(pb);
> + int last, last_start;
>
> if (!viv->num_audio)
> return AVERROR_INVALIDDATA;
> @@ -704,14 +705,22 @@ static int viv_read_packet(AVFormatContext *s,
> start = ffio_read_varlen(pb);
> pcm_bytes = ffio_read_varlen(pb);
>
> - if (i > 0 && start == 0)
> - break;
> + if (i > 0) {
> + if (start == 0)
> + break;
> + if (start < last || start - (unsigned)last > INT_MAX)
What is the second condition for?
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list