Skip to content

Commit 53dbd3f

Browse files
committed
Fixed bcdiv() div by zero
1 parent 05f8bc7 commit 53dbd3f

File tree

1 file changed

+1
-1
lines changed
  • ext/bcmath/libbcmath/src

1 file changed

+1
-1
lines changed

ext/bcmath/libbcmath/src/div.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ bool bc_divide(bc_num numerator, bc_num divisor, bc_num *quot, size_t scale)
344344
}
345345

346346
/* If divisor is 1 / -1, the quotient's n_value is equal to numerator's n_value. */
347-
if (_bc_do_compare(divisor, BCG(_one_), scale, false) == BCMATH_EQUAL) {
347+
if (_bc_do_compare(divisor, BCG(_one_), divisor->n_scale, false) == BCMATH_EQUAL) {
348348
size_t quot_scale = MIN(numerator->n_scale, scale);
349349
*quot = bc_new_num_nonzeroed(numerator->n_len, quot_scale);
350350
char *qptr = (*quot)->n_value;

0 commit comments

Comments
 (0)