Skip to content

Commit b5cb20b

Browse files
Nick ShaforostovNick Shaforostoff
Nick Shaforostov
authored and
Nick Shaforostoff
committed
avoid freezes reading incomplete mp3 files
1 parent a800931 commit b5cb20b

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
@@ -110,7 +110,7 @@ bool MPEG::File::isSupported(IOStream *stream)
110110

111111
if(buffer.isEmpty())
112112
return false;
113-
113+
114114
const long originalPosition = stream->tell();
115115
AdapterFile file(stream);
116116

@@ -466,6 +466,9 @@ long MPEG::File::lastFrameOffset()
466466
else
467467
position = length();
468468

469+
if (position >= length()) //if the file is incomplete
470+
position = length();
471+
469472
return previousFrameOffset(position);
470473
}
471474

0 commit comments

Comments
 (0)