Skip to content

Commit

Permalink
avoid freezes reading incomplete mp3 files
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Shaforostov authored and Nick Shaforostoff committed Oct 25, 2020
1 parent 91b00b1 commit 9310755
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion taglib/mpeg/mpegfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool MPEG::File::isSupported(IOStream *stream)
const ByteVector buffer = Utils::readHeader(stream, bufferSize(), true, &headerOffset);

if(buffer.isEmpty())
return false;
return false;

const long originalPosition = stream->tell();
AdapterFile file(stream);
Expand Down Expand Up @@ -476,6 +476,9 @@ long MPEG::File::lastFrameOffset()
else
position = length();

if (position >= length()) //if the file is incomplete
position = length();

return previousFrameOffset(position);
}

Expand Down

0 comments on commit 9310755

Please sign in to comment.