Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of nullptr check in src/crypto/crypto_ec.cc GroupOrderSize #56692

Open
wooffie opened this issue Jan 22, 2025 · 0 comments
Open

Lack of nullptr check in src/crypto/crypto_ec.cc GroupOrderSize #56692

wooffie opened this issue Jan 22, 2025 · 0 comments

Comments

@wooffie
Copy link

wooffie commented Jan 22, 2025

Version

20.18.0

Platform

any

Subsystem

crypto

What steps will reproduce the bug?

In function GroupOrderSize call of BignumPointer::New() can return nullptr pointer (yes its can raise error via ERR_raise).

auto order = BignumPointer::New();

After this ptr passed to EC_GROUP_get_order

CHECK(EC_GROUP_get_order(ECKeyPointer::GetGroup(ec), order.get(), nullptr));

But this function don't expect that second param can be NULL

int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx)

After nullptr can be dereferenced here:

return (words <= a->dmax) ? a : bn_expand2(a, words);

And in another places

How often does it reproduce? Is there a required condition?

If BignumPointer::New() return pointer that stores nullptr

What is the expected behavior? Why is that the expected behavior?

Check BignumPointer::New() for nullptr

What do you see instead?

Lack of nullptr check

Additional information

Additional information
Found by Linux Verification Center (linuxtesting.org) with SVACE.

Reporter: Burkov Egor ([email protected]).

Organization: R-Vision ([email protected]).

wooffie pushed a commit to wooffie/node that referenced this issue Jan 22, 2025
I think it's missed, cause in this file we have example of checking
result of BignumPointer::new

Refs: nodejs#56692
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant