mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Fix out-of-bound write in libbf
This commit is contained in:
parent
7491c81153
commit
1db8d6cc19
1 changed files with 7 additions and 0 deletions
7
libbf.c
7
libbf.c
|
@ -1710,6 +1710,13 @@ static int __bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec,
|
|||
slimb_t d;
|
||||
|
||||
na = n + nb;
|
||||
|
||||
#if LIMB_LOG2_BITS == 6
|
||||
if (na >= (SIZE_MAX / sizeof(limb_t)) - 1) {
|
||||
return BF_ST_MEM_ERROR; /* Return memory error status */
|
||||
}
|
||||
#endif
|
||||
|
||||
taba = bf_malloc(s, (na + 1) * sizeof(limb_t));
|
||||
if (!taba)
|
||||
goto fail;
|
||||
|
|
Loading…
Reference in a new issue