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:
Michael Niedermayer 2013-05-04 10:33:50 +02:00
commit 23a7c32a7a

View File

@ -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;