Do not attempt to store out-of-range street number.
authormark burdett <mfburdett@gmail.com>
Sat, 22 Dec 2018 19:11:57 +0000 (11:11 -0800)
committermark burdett <mfburdett@gmail.com>
Sun, 24 Feb 2019 23:48:58 +0000 (15:48 -0800)
CRM/Core/BAO/Address.php
CRM/Utils/Type.php

index 4ada8f0bdffce193cefd355d2d0f5055e6750704..2ff74bbb3740a2ed0726826795635103670f18b9 100644 (file)
@@ -771,6 +771,11 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC,
       $streetAddress = trim($streetAddress);
     }
 
+    // If street number is too large, we cannot store it.
+    if ($parseFields['street_number'] > CRM_Utils_Type::INT_MAX) {
+      return $emptyParseFields;
+    }
+
     // suffix might be like 1/2
     $matches = array();
     if (preg_match('/^\d\/\d/', $streetAddress, $matches)) {
index 42f1ffc9b343dc6a5223f557ac48204a922c668b..d45392353d4b799e2eb4d85ef4a0cec082313173 100644 (file)
@@ -72,6 +72,11 @@ class CRM_Utils_Type {
    */
   const BLOB_SIZE = 65535;
 
+  /**
+   * Maximum value of a MySQL signed INT column.
+   */
+  const INT_MAX = 2147483647;
+
   /**
    * Gets the string representation for a data type.
    *