Ensure bcmath scale is between 0 and INT_MAX

Make sure bcmatch scale is between 0 and INT_MAX, both for the
ini setting, and all the functions accepting a scale argument.
A ValueError is thrown if a function argument is out of range.

Closes GH-5455.
This commit is contained in:
Vladyslav Startsev 2020-04-25 02:18:09 +03:00 committed by Nikita Popov
parent 48a34bc120
commit b64aee9706
6 changed files with 177 additions and 36 deletions

View file

@ -33,7 +33,7 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath)
bc_num _zero_;
bc_num _one_;
bc_num _two_;
zend_long bc_precision;
int bc_precision;
ZEND_END_MODULE_GLOBALS(bcmath)
#if defined(ZTS) && defined(COMPILE_DL_BCMATH)