mirror of
https://github.com/librempeg/librempeg
synced 2024-11-23 11:39:47 +00:00
Merge remote-tracking branch 'qatar/master'
* qatar/master: wav: return meaningful errors Conflicts: libavformat/wavdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
23a7c32a7a
@ -69,7 +69,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
|
||||
|
||||
for (;;) {
|
||||
if (url_feof(pb))
|
||||
return -1;
|
||||
return AVERROR_EOF;
|
||||
size = next_tag(pb, &tag);
|
||||
if (tag == tag1)
|
||||
break;
|
||||
@ -243,18 +243,18 @@ static int wav_read_header(AVFormatContext *s)
|
||||
|
||||
rf64 = tag == MKTAG('R', 'F', '6', '4');
|
||||
if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F'))
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_rl32(pb); /* file size */
|
||||
tag = avio_rl32(pb);
|
||||
if (tag != MKTAG('W', 'A', 'V', 'E'))
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (rf64) {
|
||||
if (avio_rl32(pb) != MKTAG('d', 's', '6', '4'))
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
size = avio_rl32(pb);
|
||||
if (size < 24)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_rl64(pb); /* RIFF size */
|
||||
|
||||
data_size = avio_rl64(pb);
|
||||
@ -405,12 +405,12 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16])
|
||||
avio_read(pb, guid, 16);
|
||||
size = avio_rl64(pb);
|
||||
if (size <= 24)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!memcmp(guid, guid1, 16))
|
||||
return size;
|
||||
avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24);
|
||||
}
|
||||
return -1;
|
||||
return AVERROR_EOF;
|
||||
}
|
||||
|
||||
#define MAX_SIZE 4096
|
||||
@ -590,16 +590,16 @@ static int w64_read_header(AVFormatContext *s)
|
||||
|
||||
avio_read(pb, guid, 16);
|
||||
if (memcmp(guid, ff_w64_guid_riff, 16))
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* riff + wave + fmt + sizes */
|
||||
if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avio_read(pb, guid, 16);
|
||||
if (memcmp(guid, ff_w64_guid_wave, 16)) {
|
||||
av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
wav->w64 = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user