-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Description
By modeling the issue fixed by commit 0e8b6c9 with codeql I was able to find some variants of the pattern .
Bug 1:
Line 149 in 9311d0c
| goto err; |
If mods = OPENSSL_zalloc(sizeof(*mods) * NUMPRIMES); fails to allocate memory it will execute a goto that will perform BN_CTX_end(ctx); on the context without a matching BN_CTX_start.
Bug 2:
Line 31 in 605856d
| goto end; |
If ret = BN_new(); fails to allocate memory it will execute a goto that will perform BN_CTX_end(ctx); on the context without a matching BN_CTX_start.
This can happen twice in the function so both cases would need to be addressed.
Bug 3:
Line 177 in 4261939
| goto err; |
If BN_priv_rand_ex(Xp, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY, ctx)) fails it will execute a goto that will perform BN_CTX_end(ctx); on the context without a matching BN_CTX_start.
Bug 4:
Line 850 in 9311d0c
| goto err; |
If generator = EC_GROUP_get0_generator(group); is null, it will execute a goto that will perform BN_CTX_end(ctx); on the context without a matching BN_CTX_start.
I've already fixed the issues and am creating the issue to refer to it in the PR.