mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Added missing error check inside bcpowmod().
This commit is contained in:
parent
a6340d27ae
commit
1bd2791cd4
1
NEWS
1
NEWS
@ -8,6 +8,7 @@ PHP NEWS
|
||||
- Added missing open_basedir checks to CGI. (anight at eyelinkmedia dot com,
|
||||
Tony)
|
||||
- Added missing format validator to unpack() function. (Ilia)
|
||||
- Added missing error check inside bcpowmod(). (Ilia)
|
||||
- Fixed several integer overflows in ImageCreate(), ImageCreateTrueColor(),
|
||||
ImageCopyResampled() and ImageFilledPolygon() reported by Mattias Bengtsson.
|
||||
(Tony)
|
||||
|
@ -465,13 +465,17 @@ PHP_FUNCTION(bcpowmod)
|
||||
|
||||
scale_int = (int) ((int)scale < 0) ? 0 : scale;
|
||||
|
||||
bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC);
|
||||
if (result->n_scale > scale) {
|
||||
result->n_scale = scale;
|
||||
if (bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC) != -1) {
|
||||
if (result->n_scale > scale) {
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&mod);
|
||||
|
Loading…
Reference in New Issue
Block a user