Skip to content

Commit

Permalink
bugfix #2514: FLAC zero-byte block header
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHeinrich committed Oct 17, 2018
1 parent dd1099b commit 7aec0d4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
29 changes: 29 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@
Version History
===============

1.9.16: [2018-10-17] James Heinrich :: 1.9.16-201810171314
* bugfix (G:168) Ogg FLAC not parsed
* bugfix (G:163) invalid MP3 header error on VBR
* bugfix (G:162) prevent writing multiple ID3v2 versions
* bugfix (G:161) MP3 VBR header duration
* bugfix (G:160) OggOpus duration sometimes incorrect
* bugfix (G:157) quicktime GPS invalid argument
* bugfix (G:148) MPEG-2 aspect ratio
* bugfix (G:147) Quicktime fourcc codec name lookup
* bugfix (G:147) Quicktime audio/video bitrate guessing
* bugfix (G:145) incompatible variable types
* bugfix (G:139) Quicktime islt subatoms >5
* bugfix (G:137) ID3v2 semi-numeric genres
* bugfix (G:136) ID3v2 unsynchronised typo
* bugfix (#2514) FLAC zero-byte block header
* bugfix (#2488) MIME types (FLAC, WAV, gzip)
* bugfix (#2468) Quicktime video rotation
* bugfix (#2207) metaflac + attached pictures
* bugfix (#2151) improved demo UNC filename support
* bugfix (#1966) fread fail when PHP memory_limit -1
* bugfix (#1908) Quicktime rotation detection (using matrix values)
* bugfix (#1908) Quicktime "rcif" and "dscp" atoms
* bugfix (#1900) demo.joinmp3 cut from end
* security: avoid disabled demo reflection
* TIFF: expand list of named tags, expose as 'tag_name' key for all entries
* Quicktime: parse some GoPro-specific data
* helperapps (Windows): updated vorbiscomment.exe, metaflac.exe to v1.3.2
* add more image formats supported by getimagesize()

1.9.15: [2017-10-26] James Heinrich :: 1.9.15-201709291043
» (G:108) add basic APNG support
» (G:107) add basic WebP support
Expand Down
2 changes: 1 addition & 1 deletion getid3/getid3.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class getID3
*/
protected $startup_warning = '';

const VERSION = '1.9.15-201809221240';
const VERSION = '1.9.16-201810171314';
const FREAD_BUFFER_SIZE = 32768;

const ATTACHMENTS_NONE = false;
Expand Down
7 changes: 6 additions & 1 deletion getid3/module.audio.flac.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function parseMETAdata() {
do {
$BlockOffset = $this->ftell();
$BlockHeader = $this->fread(4);
$LBFBT = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1));
$LBFBT = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1)); // LBFBT = LastBlockFlag + BlockType
$LastBlockFlag = (bool) ($LBFBT & 0x80);
$BlockType = ($LBFBT & 0x7F);
$BlockLength = getid3_lib::BigEndian2Int(substr($BlockHeader, 1, 3));
Expand All @@ -63,6 +63,11 @@ public function parseMETAdata() {
break;
}
if ($BlockLength < 1) {
if ($BlockTypeText != 'reserved') {
// probably supposed to be zero-length
$this->warning('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockTypeText.') at offset '.$BlockOffset.' is zero bytes');
continue;
}
$this->error('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockLength.') at offset '.$BlockOffset.' is invalid');
break;
}
Expand Down

0 comments on commit 7aec0d4

Please sign in to comment.