3 /////////////////////////////////////////////////////////////////
4 /// getID3() by James Heinrich <info@getid3.org> //
5 // available at https://github.com/JamesHeinrich/getID3 //
6 // or https://www.getid3.org //
7 // or http://getid3.sourceforge.net //
8 // see readme.txt for more details //
9 /////////////////////////////////////////////////////////////////
11 // module.archive.xz.php //
12 // module for analyzing XZ files //
13 // dependencies: NONE //
15 /////////////////////////////////////////////////////////////////
17 if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers
21 class getid3_xz
extends getid3_handler
27 public function Analyze() {
28 $info = &$this->getid3
->info
;
30 $this->fseek($info['avdataoffset']);
31 $xzheader = $this->fread(6);
33 // https://tukaani.org/xz/xz-file-format-1.0.4.txt
34 $info['xz']['stream_header']['magic'] = substr($xzheader, 0, 6);
35 if ($info['xz']['stream_header']['magic'] != "\xFD".'7zXZ'."\x00") {
36 $this->error('Invalid XZ stream header magic (expecting FD 37 7A 58 5A 00, found '.getid3_lib
::PrintHexBytes($info['xz']['stream_header']['magic']).') at offset '.$info['avdataoffset']);
39 $info['fileformat'] = 'xz';
40 $this->error('XZ parsing not enabled in this version of getID3() ['.$this->getid3
->version().']');