Fix the potential integer overflow from "offset + size".
[pdfium.git] / pdfium.gyp
index 732c2ab..ff61931 100644 (file)
       }],
     ],
     'msvs_disabled_warnings': [
-      4005, 4018, 4146, 4333, 4345
+      4005, 4018, 4146, 4333, 4345, 4267
     ],
   },
   'targets': [
     {
-      'target_name': 'fpdfsdk',
+      'target_name': 'pdfium',
       'type': 'static_library',
       'dependencies': [
+        'safemath',
         'fdrm',
         'fpdfdoc',
         'fpdfapi',
           ],
         }],
       ],
+      'all_dependent_settings': {
+        'msvs_settings': {
+          'VCLinkerTool': {
+            'AdditionalDependencies': [
+              'advapi32.lib',
+              'gdi32.lib',
+              'user32.lib',
+            ],
+          },
+        },
+        'conditions': [
+          ['OS=="mac"', {
+            'link_settings': {
+              'libraries': [
+                '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
+                '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
+              ],
+            },
+          }],
+        ],
+      },
+    },
+    {
+      'target_name': 'safemath',
+      'type': 'none',
+      'sources': [
+        'third_party/logging.h',
+        'third_party/macros.h',
+        'third_party/template_util.h',
+        'third_party/numerics/safe_conversions.h',
+        'third_party/numerics/safe_conversions_impl.h',
+        'third_party/numerics/safe_math.h',
+        'third_party/numerics/safe_math_impl.h',
+      ],
     },
     {
       'target_name': 'fdrm',
         'core/src/fxcodec/libjpeg/makefile',
         'core/src/fxcodec/libjpeg/transupp.h',
       ],
+      'conditions': [
+        ['os_posix==1', {
+          # core/src/fxcodec/fx_libopenjpeg/src/fx_mct.c does an pointer-to-int
+          # conversion to check that an address is 16-bit aligned (benign).
+          'cflags_c': [ '-Wno-pointer-to-int-cast' ],
+        }],
+      ],
     },
     {
       'target_name': 'fxcrt',
         'core/src/fxcrt/fx_basic_list.cpp',
         'core/src/fxcrt/fx_basic_maps.cpp',
         'core/src/fxcrt/fx_basic_memmgr.cpp',
-        'core/src/fxcrt/fx_basic_memmgr_mini.cpp',
         'core/src/fxcrt/fx_basic_plex.cpp',
         'core/src/fxcrt/fx_basic_utf.cpp',
         'core/src/fxcrt/fx_basic_util.cpp',
         'core/src/fxcrt/fx_unicode.cpp',
         'core/src/fxcrt/fx_xml_composer.cpp',
         'core/src/fxcrt/fx_xml_parser.cpp',
-        'core/src/fxcrt/mem_int.h',
         'core/src/fxcrt/plex.h',
         'core/src/fxcrt/xml_int.h',
       ],
       'target_name': 'javascript',
       'type': 'static_library',
         'include_dirs': [
+          '<(DEPTH)/v8',
           '<(DEPTH)/v8/include',
         ],
       'dependencies': [
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
+        '<(DEPTH)/v8/tools/gyp/v8.gyp:v8_libplatform',
       ],
       'export_dependent_settings': [
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
       ],
       'include_dirs': [
+        '<(DEPTH)/v8',
         '<(DEPTH)/v8/include',
       ],
       'ldflags': [ '-L<(PRODUCT_DIR)',],
       ],
     },
   ],
-  'conditions': [
-    ['OS=="mac" or OS=="linux"', {
-      'targets': [
-        {
-          'target_name': 'gcctest',
-          'type': 'executable',
-          'dependencies': [
-            'fpdfsdk',
-          ],
-          'conditions': [
-            ['OS=="mac"', {
-              'link_settings': {
-                'libraries': [
-                  '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
-                ],
-              },
-            }],
-          ],
-          'sources': [
-            'test/gcctest.cpp',
-          ],
-        }
-      ],
-    }],
-  ],
 }
-