From d01ae020e7685243fa8c11b3f65c85cf4eb7c1c2 Mon Sep 17 00:00:00 2001 From: mark burdett Date: Sat, 22 Dec 2018 11:11:57 -0800 Subject: [PATCH] Do not attempt to store out-of-range street number. --- CRM/Core/BAO/Address.php | 5 +++++ CRM/Utils/Type.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 4ada8f0bdf..2ff74bbb37 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -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)) { diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index 42f1ffc9b3..d45392353d 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -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. * -- 2.25.1