[SPIP] ~maj v3.2.9-->v3.2.11
[lhc/web/www.git] / www / plugins-dist / medias / lib / getid3 / module.graphic.gif.php
index 4fb1247..0e463c8 100644 (file)
  * @link https://www.w3.org/Graphics/GIF/spec-gif89a.txt
  * @link http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp
  */
+
+if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers
+       exit;
+}
+
 class getid3_gif extends getid3_handler
 {
        /**
@@ -46,6 +51,10 @@ class getid3_gif extends getid3_handler
                        return false;
                }
 
+               //if (!$this->getid3->option_extra_info) {
+               //      $this->warning('GIF Extensions and Global Color Table not returned due to !getid3->option_extra_info');
+               //}
+
                $info['gif']['header']['raw']['version']               =                              substr($GIFheader, $offset, 3);
                $offset += 3;
                $info['gif']['header']['raw']['width']                 = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 2));
@@ -85,12 +94,15 @@ class getid3_gif extends getid3_handler
 
                if ($info['gif']['header']['flags']['global_color_table']) {
                        $GIFcolorTable = $this->fread(3 * $info['gif']['header']['global_color_size']);
-                       $offset = 0;
-                       for ($i = 0; $i < $info['gif']['header']['global_color_size']; $i++) {
-                               $red   = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
-                               $green = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
-                               $blue  = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
-                               $info['gif']['global_color_table'][$i] = (($red << 16) | ($green << 8) | ($blue));
+                       if ($this->getid3->option_extra_info) {
+                               $offset = 0;
+                               for ($i = 0; $i < $info['gif']['header']['global_color_size']; $i++) {
+                                       $red   = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
+                                       $green = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
+                                       $blue  = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
+                                       $info['gif']['global_color_table'][$i] = (($red << 16) | ($green << 8) | ($blue));
+                                       $info['gif']['global_color_table_rgb'][$i] = sprintf('%02X%02X%02X', $red, $green, $blue);
+                               }
                        }
                }
 
@@ -166,7 +178,9 @@ class getid3_gif extends getid3_handler
                                                }
                                        }
 
-                                       $info['gif']['extension_blocks'][] = $ExtensionBlock;
+                                       if ($this->getid3->option_extra_info) {
+                                               $info['gif']['extension_blocks'][] = $ExtensionBlock;
+                                       }
                                        break;
 
                                case ';':