-
Notifications
You must be signed in to change notification settings - Fork 106
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
Modify jdk.crypto.ec libsunec mpi.c to avoid writes to unallocated mem #726
Conversation
Not sure my original fix is the best solution. It seems safe with the current usage of mp_cmp_int() but perhaps asserting if there is an error is a better way to go. |
I've updated to implement it without allocation. |
07e2237
to
670bab7
Compare
int out; | ||
|
||
mp_sign signz = z < 0 ? ZNEG : ZPOS; | ||
|
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.
Please remove the trailing whitespace here.
This file should have an IBM copyright notice.
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.
Updated and running new testing via https://openj9-jenkins.osuosl.org/job/Pipeline-Build-Test-Personal/451/
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.
[2023-11-08T22:05:46.059Z] /home/jenkins/workspace/Build_JDK11_s390x_linux_Personal/src/jdk.crypto.ec/share/native/libsunec/impl/mpi.c: In function 'mp_cmp_int':
[2023-11-08T22:05:46.059Z] /home/jenkins/workspace/Build_JDK11_s390x_linux_Personal/src/jdk.crypto.ec/share/native/libsunec/impl/mpi.c:1736:27: error: 'ZNEG' undeclared (first use in this function); did you mean 'NEG'?
ZNEG
should be NEG
(see e.g. line 376); I suppose NEG
means "negative" and ZPOS
means "zero or positive".
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.
This is not just to please the compiler, it fixes a potential real problem (misbehavior on allocation failure): perhaps the title and description should be updated. |
Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
See https://openj9-jenkins.osuosl.org/job/Build_JDK11_s390x_linux_Personal/767/ for the gcc 11.2 compile error on the original code.
Tested via
https://openj9-jenkins.osuosl.org/job/Pipeline-Build-Test-Personal/448/
https://openj9-jenkins.osuosl.org/job/Pipeline-Build-Test-Personal/452/