-
Notifications
You must be signed in to change notification settings - Fork 914
20251229 Coverity Dereference before Null check #9591
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
base: master
Are you sure you want to change the base?
Conversation
145ce01 to
9f9f3b4
Compare
add new scope, whitespace
|
retest this please jenkins: Agent offline exception |
| if (P == NULL || modulus == NULL){ | ||
| return ECC_BAD_ARG_E; | ||
| } | ||
| { |
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 DECL_MP_INT_SIZE_DYN can be at top, this is just declaring, not allocating... that's done in NEW_MP_INT_SIZE. Then revert all the indent changes. Thanks
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.
I think it's reasonable to close this PR without merging then. The remaining changes wouldn't make a difference.
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.
I like the new argument NULL checking since this API can be built as public facing.
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.
Sorry, just remembered the logic for the change here. The current format moves DECL_MP_INT_SIZE_DYN below the already existing NULL check since mp_bitsused(modulus) is defined ((a)->used * SP_WORD_SIZE), which is what flagged the original Coverity issue. The additional scope and indent prevents C99 standard compilation issues.
Description
CID 315897 Dereference before null check - move null check to prevent dereference before null check issue