Hi developers,
I'm writing to report some bugs we met in the relic API.
that it seems to have an interger overflow while doing `realloc`, for example when:
`bn_grow(r0, 0x20000000)` it would become `realloc(ptr, "a small number")` and return successfully, and causing some heap overflow in more later calls.
And we happened to trigger it through some other APIs like `bn_gen_prime` or `bn_rand`. Maybe there should be more checks at here?
Another one is also an interger overflow and trival to fix here:
that in `bn_get_prime`, if the `pos` is a negative number, it would pass the error checking and cause some global buffer corruption. Maybe the `pos` should be an unsigned int?
Could you help us verify these issues? Thanks!!