Fixed out-of-bound write in libbf.c
This commit is contained in:
parent
6e2e68fd08
commit
f4d9fcfc5b
1 changed files with 5 additions and 0 deletions
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;
|
||||
|
||||
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));
|
||||
if (!taba)
|
||||
goto fail;
|
||||
|
|
Loading…
Reference in a new issue