-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
crypto: check for nullptr before dereferencing identity_buf #57071
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
Conversation
Review requested:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #57071 +/- ##
==========================================
- Coverage 90.37% 90.26% -0.11%
==========================================
Files 629 630 +1
Lines 184365 184634 +269
Branches 36016 36131 +115
==========================================
+ Hits 166612 166666 +54
- Misses 10918 11025 +107
- Partials 6835 6943 +108
🚀 New features to boost your workflow:
|
Don't know how to test this since any js code would have its argument validated before moving to the C++ side |
This comment was marked as outdated.
This comment was marked as outdated.
Rebased |
This comment was marked as outdated.
This comment was marked as outdated.
CI failures seem unrelated? |
This comment was marked as outdated.
This comment was marked as outdated.
Yeah seems to be random this CI failure, it was linux and now it's macos |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please clarify how these tests are related to the actual patch? In particular, do any of the tests bypass these existing checks?
Lines 1540 to 1541 in a20acd4
if (ret.IsEmpty() || !ret->IsObject()) [[unlikely]] | |
return 0; |
Lines 1547 to 1548 in a20acd4
if (psk_val.IsEmpty() || !psk_val->IsArrayBufferView()) [[unlikely]] | |
return 0; |
Lines 1556 to 1557 in a20acd4
if (identity_val.IsEmpty() || !identity_val->IsString()) [[unlikely]] | |
return 0; |
I must be missing or misunderstanding something about the issue itself, too. Could you please clarify why identity_buf
could contain a nullptr
at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test appears to be completely unrelated to the patch. Even if the validation in JS was removed, both tests would fail the following check before ever reaching the modified location:
Lines 1540 to 1541 in a20acd4
if (ret.IsEmpty() || !ret->IsObject()) [[unlikely]] | |
return 0; |
There is no other way you can test this input type from JS side, even if it gets checked before, tomorrow it might change But anyway I don't think this is import right now |
I did not mean for this to be closed, I'd just like to understand what bug this patch is supposed to catch. I'd be happy to remove my request for changes upon an explanation. I might simply be missing some detail here. |
Yeah so the passed value is being dereferenced but it can be nullptr in theory Currently, it's type is checked on the JS side but this C++ code would be problematic if tomorrow the JS side is changed So I don't know if this is truly important to land right now |
The js-side already checks for this so the test already passes, so I don't think it's a vulnerability
Just in case, added the check for future
Fix #56665