]> git.wh0rd.org - tt-rss.git/blobdiff - lib/floIcon.php
floIcon: add experimental SizeInBytes cap
[tt-rss.git] / lib / floIcon.php
index e1d1b84e2b2c234976f66e78fae8a85487b28a6f..59902b6a4ee5b8ad4da8fd5bb9913dc1818d99af 100644 (file)
@@ -291,8 +291,9 @@ class floIcon {
                         $header = unpack("SReserved/SType/SCount", fread($filePointer, 6));
                         for ($t = 0; $t < $header["Count"]; $t++) {
                                 $newImage = new floIconImage();
-                                $newImage->readImageFromICO($filePointer, 6 + ($t * 16));
-                                $this->images[] = $newImage;
+                                if ($newImage->readImageFromICO($filePointer, 6 + ($t * 16))) {
+                                                                                         $this->images[] = $newImage;
+                                                                                 }
                         }
                         fclose($filePointer);
                 }
@@ -780,9 +781,8 @@ class floIconImage {
                 $this->_entryIconFormat = fread($filePointer, 16);
                 $this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $this->_entryIconFormat);
 
-                                        // fox
                                         if ($this->_entry["SizeInBytes"] > 16384)
-                                                $this->_entry["SizeInBytes"] = 16384;
+                                                return false;
 
                 // Position the file pointer.
                 fseek($filePointer, $this->_entry["FileOffset"]);
@@ -819,7 +819,9 @@ class floIconImage {
                 }
                 if ($this->_entry["Height"] == 0) {
                         $this->_entry["Height"] = $this->_header["Height"]/2;
-                }
+                                        }
+
+                                        return true;
         }
         function getHeader() {
                 return $this->_header;