From 8574bcd494ac2a197d98e098c3a5c9cef9186cbf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 23 Aug 2014 13:26:17 +0200 Subject: decoder/dsf: compare with InputStream::GetRest() instead of ..GetSize() --- src/decoder/plugins/DsfDecoderPlugin.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/decoder') diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx index 953096a45..254cf8d36 100644 --- a/src/decoder/plugins/DsfDecoderPlugin.cxx +++ b/src/decoder/plugins/DsfDecoderPlugin.cxx @@ -158,11 +158,8 @@ dsf_read_metadata(Decoder *decoder, InputStream &is, data_size -= sizeof(data_chunk); /* data_size cannot be bigger or equal to total file size */ - if (is.KnownSize()) { - const offset_type size = is.GetSize(); - if (data_size >= size) - return false; - } + if (is.KnownSize() && data_size > is.GetRest()) + return false; /* use the sample count from the DSF header as the upper bound, because some DSF files contain junk at the end of -- cgit v1.2.3