mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-13 18:40:03 +01:00
avi: Validate sample_size
And either error out or set it to 0 if it is negative.
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 4d0ee4962b)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Conflicts:
libavformat/avidec.c
This commit is contained in:
committed by
Andreas Cadhalpun
parent
0856eea770
commit
0f7e67be3a
@@ -692,6 +692,23 @@ static int avi_read_header(AVFormatContext *s)
|
|||||||
default:
|
default:
|
||||||
av_log(s, AV_LOG_INFO, "unknown stream type %X\n", tag1);
|
av_log(s, AV_LOG_INFO, "unknown stream type %X\n", tag1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ast->sample_size < 0) {
|
||||||
|
if (s->error_recognition & AV_EF_EXPLODE) {
|
||||||
|
av_log(s, AV_LOG_ERROR,
|
||||||
|
"Invalid sample_size %d at stream %d\n",
|
||||||
|
ast->sample_size,
|
||||||
|
stream_index);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
av_log(s, AV_LOG_WARNING,
|
||||||
|
"Invalid sample_size %d at stream %d "
|
||||||
|
"setting it to 0\n",
|
||||||
|
ast->sample_size,
|
||||||
|
stream_index);
|
||||||
|
ast->sample_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (ast->sample_size == 0) {
|
if (ast->sample_size == 0) {
|
||||||
st->duration = st->nb_frames;
|
st->duration = st->nb_frames;
|
||||||
if (st->duration > 0 && avi->io_fsize > 0 && avi->riff_end > avi->io_fsize) {
|
if (st->duration > 0 && avi->io_fsize > 0 && avi->riff_end > avi->io_fsize) {
|
||||||
|
|||||||
Reference in New Issue
Block a user