mirror of https://git.ffmpeg.org/ffmpeg.git
shorten: validate values in fmt chunk search
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
18bcfc912e
commit
5e9a56a035
|
@ -205,7 +205,7 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
short wave_format;
|
short wave_format;
|
||||||
|
const uint8_t *end= header + header_size;
|
||||||
|
|
||||||
if (bytestream_get_le32(&header) != MKTAG('R','I','F','F')) {
|
if (bytestream_get_le32(&header) != MKTAG('R','I','F','F')) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "missing RIFF tag\n");
|
av_log(avctx, AV_LOG_ERROR, "missing RIFF tag\n");
|
||||||
|
@ -221,6 +221,8 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
|
||||||
|
|
||||||
while (bytestream_get_le32(&header) != MKTAG('f','m','t',' ')) {
|
while (bytestream_get_le32(&header) != MKTAG('f','m','t',' ')) {
|
||||||
len = bytestream_get_le32(&header);
|
len = bytestream_get_le32(&header);
|
||||||
|
if(len<0 || end - header - 8 < len)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
header += len;
|
header += len;
|
||||||
}
|
}
|
||||||
len = bytestream_get_le32(&header);
|
len = bytestream_get_le32(&header);
|
||||||
|
|
Loading…
Reference in New Issue