Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid freezes reading incomplete mp3 files #857

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
avoid freezes reading incomplete mp3 files
  • Loading branch information
Nick Shaforostov authored and Nick Shaforostoff committed Oct 25, 2020
commit 7db76720bb01e3a8f6f3f182659359eb4c02135e
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