summaryrefslogtreecommitdiff
path: root/ext/bcmath/bcmath.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bcmath/bcmath.c')
-rw-r--r--ext/bcmath/bcmath.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index 33be8465c2..ecfce4f54d 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -198,11 +198,15 @@ static void php_str2num(bc_num *num, char *str)
char *p;
if (!(p = strchr(str, '.'))) {
- bc_str2num(num, str, 0);
+ if (!bc_str2num(num, str, 0)) {
+ php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
+ }
return;
}
- bc_str2num(num, str, strlen(p+1));
+ if (!bc_str2num(num, str, strlen(p+1))) {
+ php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
+ }
}
/* }}} */
@@ -527,8 +531,12 @@ PHP_FUNCTION(bccomp)
bc_init_num(&first);
bc_init_num(&second);
- bc_str2num(&first, ZSTR_VAL(left), scale);
- bc_str2num(&second, ZSTR_VAL(right), scale);
+ if (!bc_str2num(&first, ZSTR_VAL(left), scale)) {
+ php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
+ }
+ if (!bc_str2num(&second, ZSTR_VAL(right), scale)) {
+ php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
+ }
RETVAL_LONG(bc_compare(first, second));
bc_free_num(&first);