mirror of
https://github.com/bellard/quickjs.git
synced 2024-11-22 21:58:12 +08:00
Fixed out-of-bound write in libbf.c
This commit is contained in:
parent
6e2e68fd08
commit
f4d9fcfc5b
5
libbf.c
5
libbf.c
@ -1715,6 +1715,11 @@ static int __bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec,
|
|||||||
slimb_t d;
|
slimb_t d;
|
||||||
|
|
||||||
na = n + nb;
|
na = n + nb;
|
||||||
|
|
||||||
|
if (na >= (SIZE_MAX / sizeof(limb_t)) - 1) {
|
||||||
|
return BF_ST_MEM_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
taba = bf_malloc(s, (na + 1) * sizeof(limb_t));
|
taba = bf_malloc(s, (na + 1) * sizeof(limb_t));
|
||||||
if (!taba)
|
if (!taba)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Loading…
Reference in New Issue
Block a user