Skip to content

Commit 7db7672

Browse files
Nick ShaforostovNick Shaforostoff
authored andcommitted
avoid freezes reading incomplete mp3 files
1 parent 91b00b1 commit 7db7672

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

taglib/mpeg/mpegfile.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ bool MPEG::File::isSupported(IOStream *stream)
109109
const ByteVector buffer = Utils::readHeader(stream, bufferSize(), true, &headerOffset);
110110

111111
if(buffer.isEmpty())
112-
return false;
112+
return false;
113113

114114
const long originalPosition = stream->tell();
115115
AdapterFile file(stream);
@@ -476,6 +476,9 @@ long MPEG::File::lastFrameOffset()
476476
else
477477
position = length();
478478

479+
if (position > length()) //if the file is incomplete
480+
position = length();
481+
479482
return previousFrameOffset(position);
480483
}
481484

0 commit comments

Comments
 (0)