decoder/dsf: check InputStream::KnownSize()

This commit is contained in:
Max Kellermann 2014-08-19 20:12:10 +02:00
parent 1a53f07d80
commit 1307633a84

View File

@ -155,9 +155,11 @@ dsf_read_metadata(Decoder *decoder, InputStream &is,
data_size -= sizeof(data_chunk); data_size -= sizeof(data_chunk);
/* data_size cannot be bigger or equal to total file size */ /* data_size cannot be bigger or equal to total file size */
if (is.KnownSize()) {
const uint64_t size = (uint64_t)is.GetSize(); const uint64_t size = (uint64_t)is.GetSize();
if (data_size >= size) if (data_size >= size)
return false; return false;
}
/* use the sample count from the DSF header as the upper /* use the sample count from the DSF header as the upper
bound, because some DSF files contain junk at the end of bound, because some DSF files contain junk at the end of