summaryrefslogtreecommitdiff
path: root/sql/my_decimal.h
diff options
context:
space:
mode:
authorholyfoot/hf@mysql.com/hfmain.(none) <>2007-05-25 17:21:12 +0500
committerholyfoot/hf@mysql.com/hfmain.(none) <>2007-05-25 17:21:12 +0500
commit0c0379a3720e267ba6791c6f4efcd4225dd79d01 (patch)
treef83c8bd49eaa8f8e5ff25db4abffe31a6c3f1a25 /sql/my_decimal.h
parentdb9128f84fc43e70ef88d49d5c7214bb98c47723 (diff)
downloadmariadb-git-0c0379a3720e267ba6791c6f4efcd4225dd79d01.tar.gz
decimal buffer overflow bug fixed
Diffstat (limited to 'sql/my_decimal.h')
-rw-r--r--sql/my_decimal.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index 17eb75cfdc5..5632f191b57 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -36,13 +36,18 @@ C_MODE_END
/* maximum length of buffer in our big digits (uint32) */
#define DECIMAL_BUFF_LENGTH 9
+
+/* the number of digits that my_decimal can possibly contain */
+#define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9)
+
+
/*
maximum guaranteed precision of number in decimal digits (number of our
digits * number of decimal digits in one our big digit - number of decimal
- digits in one our big digit decreased on 1 (because we always put decimal
+ digits in one our big digit decreased by 1 (because we always put decimal
point on the border of our big digits))
*/
-#define DECIMAL_MAX_PRECISION ((DECIMAL_BUFF_LENGTH * 9) - 8*2)
+#define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2)
#define DECIMAL_MAX_SCALE 30
#define DECIMAL_NOT_SPECIFIED 31
@@ -50,7 +55,7 @@ C_MODE_END
maximum length of string representation (number of maximum decimal
digits + 1 position for sign + 1 position for decimal point)
*/
-#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_PRECISION + 2)
+#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2)
/*
maximum size of packet length
*/