Skip to content

Commit d721d36

Browse files
committed
ID3v1 should not parse files shorter than 128 bytes
Because the id3v1 parser does a negative 128 byte fseek, it can only parse files that are longer than 128 bytes. Some midi files are shorter than that and could not be parsed.
1 parent edafafd commit d721d36

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

getid3/module.tag.id3v1.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public function Analyze() {
2929
if (!getid3_lib::intValueSupported($info['filesize'])) {
3030
$this->warning('Unable to check for ID3v1 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB');
3131
return false;
32+
} elseif ($info['filesize'] < 128) {
33+
$this->warning('Unable to check for ID3v1 because file is too small');
34+
return false;
3235
}
3336

3437
if($info['filesize'] < 256) {

0 commit comments

Comments
 (0)