diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-05-02 22:40:25 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-05-03 19:56:06 +0200 |
commit | 69467fb64ba4972c7aa436ded2468bb32df9fa97 (patch) | |
tree | 316d89b42af311d7c677bdc156660e2ff3be7eec /libavformat | |
parent | a5f8873620ce502d37d0cc3ef93ada2ea8fb8de7 (diff) | |
download | ffmpeg-69467fb64ba4972c7aa436ded2468bb32df9fa97.tar.gz |
wav: return meaningful errors
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/wavdec.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 07df9232d7..63f9c38e99 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -219,18 +219,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 < 16) - return -1; + return AVERROR_INVALIDDATA; avio_rl64(pb); /* RIFF size */ data_size = avio_rl64(pb); @@ -467,22 +467,22 @@ static int w64_read_header(AVFormatContext *s) avio_read(pb, guid, 16); if (memcmp(guid, 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, guid_wave, 16)) { av_log(s, AV_LOG_ERROR, "could not find wave guid\n"); - return -1; + return AVERROR_INVALIDDATA; } size = find_guid(pb, guid_fmt); if (size < 0) { av_log(s, AV_LOG_ERROR, "could not find fmt guid\n"); - return -1; + return AVERROR_INVALIDDATA; } st = avformat_new_stream(s, NULL); @@ -502,7 +502,7 @@ static int w64_read_header(AVFormatContext *s) size = find_guid(pb, guid_data); if (size < 0) { av_log(s, AV_LOG_ERROR, "could not find data guid\n"); - return -1; + return AVERROR_INVALIDDATA; } wav->data_end = avio_tell(pb) + size - 24; wav->w64 = 1; |