Skip to content

Commit

Permalink
#430 RIFF only return comment string up to first null
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHeinrich committed Dec 30, 2023
1 parent 58b883d commit 19c9d00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 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-202311100900';
const VERSION = '1.9.23-202312292105';
const FREAD_BUFFER_SIZE = 32768;

const ATTACHMENTS_NONE = false;
Expand Down
10 changes: 6 additions & 4 deletions getid3/module.audio-video.riff.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ public function Analyze() {
// assigned for text fields, resulting in a null-terminated string (or possibly just a single null) followed by garbage
// Keep only string as far as first null byte, discard rest of fixed-width data
// https://github.com/JamesHeinrich/getID3/issues/263
$null_terminator_offset = strpos($thisfile_riff_WAVE_bext_0[$bext_key], "\x00");
$thisfile_riff_WAVE_bext_0[$bext_key] = substr($thisfile_riff_WAVE_bext_0[$bext_key], 0, $null_terminator_offset);
// https://github.com/JamesHeinrich/getID3/issues/430
$thisfile_riff_WAVE_bext_0[$bext_key] = explode("\x00", $thisfile_riff_WAVE_bext_0[$bext_key])[0];
}

$thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10);
Expand Down Expand Up @@ -1132,7 +1132,8 @@ public function Analyze() {
$CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment');
foreach ($CommentsChunkNames as $key => $value) {
if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) {
$thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data'];
// https://github.com/JamesHeinrich/getID3/issues/430
$thisfile_riff['comments'][$value][] = explode("\x00", $thisfile_riff[$RIFFsubtype][$key][0]['data'])[0];
}
}
/*
Expand Down Expand Up @@ -1224,7 +1225,8 @@ public function Analyze() {
$CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment');
foreach ($CommentsChunkNames as $key => $value) {
if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) {
$thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data'];
// https://github.com/JamesHeinrich/getID3/issues/430
$thisfile_riff['comments'][$value][] = explode("\x00", $thisfile_riff[$RIFFsubtype][$key][0]['data'])[0];
}
}

Expand Down

0 comments on commit 19c9d00

Please sign in to comment.