Skip to content

Commit

Permalink
#444 ID3v2 Uninitialized string offset 0
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHeinrich committed May 20, 2024
1 parent 1192b61 commit d0e347f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion getid3/getid3.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class getID3
*/
protected $startup_warning = '';

const VERSION = '1.9.23-202404261550';
const VERSION = '1.9.23-202405201327';
const FREAD_BUFFER_SIZE = 32768;

const ATTACHMENTS_NONE = false;
Expand Down
14 changes: 8 additions & 6 deletions getid3/module.tag.id3v2.php
Original file line number Diff line number Diff line change
Expand Up @@ -1068,13 +1068,15 @@ public function ParseID3v2Frame(&$parsedFrame) {
$parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset);

$frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($frame_textencoding_terminator));
if (($timestampindex == 0) && (ord($frame_remainingdata[0]) != 0)) {
// timestamp probably omitted for first data item
} else {
$parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4));
$frame_remainingdata = substr($frame_remainingdata, 4);
if (strlen($frame_remainingdata)) { // https://github.com/JamesHeinrich/getID3/issues/444
if (($timestampindex == 0) && (ord($frame_remainingdata[0]) != 0)) {
// timestamp probably omitted for first data item
} else {
$parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4));
$frame_remainingdata = substr($frame_remainingdata, 4);
}
$timestampindex++;
}
$timestampindex++;
}
}
unset($parsedFrame['data']);
Expand Down

0 comments on commit d0e347f

Please sign in to comment.