floIcon: add experimental SizeInBytes cap
This commit is contained in:
parent
ce2b219c64
commit
6a1f424924
|
@ -291,9 +291,10 @@ class floIcon {
|
||||||
$header = unpack("SReserved/SType/SCount", fread($filePointer, 6));
|
$header = unpack("SReserved/SType/SCount", fread($filePointer, 6));
|
||||||
for ($t = 0; $t < $header["Count"]; $t++) {
|
for ($t = 0; $t < $header["Count"]; $t++) {
|
||||||
$newImage = new floIconImage();
|
$newImage = new floIconImage();
|
||||||
$newImage->readImageFromICO($filePointer, 6 + ($t * 16));
|
if ($newImage->readImageFromICO($filePointer, 6 + ($t * 16))) {
|
||||||
$this->images[] = $newImage;
|
$this->images[] = $newImage;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fclose($filePointer);
|
fclose($filePointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,6 +781,9 @@ class floIconImage {
|
||||||
$this->_entryIconFormat = fread($filePointer, 16);
|
$this->_entryIconFormat = fread($filePointer, 16);
|
||||||
$this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $this->_entryIconFormat);
|
$this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $this->_entryIconFormat);
|
||||||
|
|
||||||
|
if ($this->_entry["SizeInBytes"] > 16384)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Position the file pointer.
|
// Position the file pointer.
|
||||||
fseek($filePointer, $this->_entry["FileOffset"]);
|
fseek($filePointer, $this->_entry["FileOffset"]);
|
||||||
|
|
||||||
|
@ -816,6 +820,8 @@ class floIconImage {
|
||||||
if ($this->_entry["Height"] == 0) {
|
if ($this->_entry["Height"] == 0) {
|
||||||
$this->_entry["Height"] = $this->_header["Height"]/2;
|
$this->_entry["Height"] = $this->_header["Height"]/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
function getHeader() {
|
function getHeader() {
|
||||||
return $this->_header;
|
return $this->_header;
|
||||||
|
|
Loading…
Reference in New Issue