1<?php 2 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///////////////////////////////////////////////////////////////// 10// // 11// module.archive.xz.php // 12// module for analyzing XZ files // 13// dependencies: NONE // 14// /// 15///////////////////////////////////////////////////////////////// 16 17if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers 18 exit; 19} 20 21class getid3_xz extends getid3_handler 22{ 23 24 /** 25 * @return bool 26 */ 27 public function Analyze() { 28 $info = &$this->getid3->info; 29 30 $this->fseek($info['avdataoffset']); 31 $xzheader = $this->fread(6); 32 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']); 37 return false; 38 } 39 $info['fileformat'] = 'xz'; 40 $this->error('XZ parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); 41 return false; 42 43 } 44 45} 46