Fix for UMR in CXML_Parser::GetCharRef.
[pdfium.git] / BUILD.gn
index 2021b4c..43b7049 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -91,6 +91,7 @@ static_library("pdfium") {
   configs += [ ":pdfium_config", "//build/config/compiler:no_chromium_code" ]
 
   deps = [
+    ":safemath",
     ":fdrm",
     ":formfiller",
     ":fpdfapi",
@@ -117,6 +118,18 @@ static_library("pdfium") {
 # Targets below this are only visible within this file.
 visibility = ":*"
 
+component("safemath") {
+  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",
+  ]
+}
+
 static_library("fdrm") {
   sources = [
     "core/include/fdrm/fx_crypt.h",
@@ -474,6 +487,12 @@ static_library("fxcodec") {
   if (is_posix) {
     configs -= [ "//build/config/gcc:no_exceptions" ]
   }
+
+  if (is_posix) {
+    # 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" ]
+  }
   configs += [ ":pdfium_config", "//build/config/compiler:no_chromium_code" ]
 }