-
Notifications
You must be signed in to change notification settings - Fork 6.2k
JDK-8259843: initialize dli_fname array before calling dll_address_to_library_name #2144
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
|
👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into |
RealLucy
left a comment
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 changes look good to me.
linuxppcle build error unrelated. Addressed by JDK-8259978.
|
@MBaesken This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 9 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
dholmes-ora
left a comment
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.
Hi Matthias,
Seems okay. One query below.
Thanks,
David
| int offset; | ||
| bool found; | ||
|
|
||
| if (buf == NULL || buflen < 1) return; |
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 this not just be an assert: buf != NULL && buflen > 0 ?
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.
Hi David, I think a return would be clearer but an assert is "better than nothing" .
Best regards, Matthias
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.
With an assert, you assume this is a "cannot occur error". You should be pretty sure to have good test coverage to find all "illegal invocations" before letting a release build escape into the wild.
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.
+1 for the assert.
If you are worried about release, combine assert with release check:
assert(buf && buflen > 1, "sanity");
if (buf == NULL || buflen < 1) return;
Its what I usually do if I want to be super thorough.
Sorry for the bikeshedding :)
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.
Hi Thomas, I like your suggestion ; David are you fine with it ?
|
Mailing list message from David Holmes on hotspot-dev: On 20/01/2021 6:32 pm, Lutz Schmidt wrote:
The problem with a return is that it implies these conditions are David |
|
/integrate |
|
@MBaesken Since your change was applied there have been 15 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 69f90b5. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
On some platforms like bsd/mac, we call dll_address_to_library_name with a buffer parameter (e.g. char dli_fname[MAXPATHLEN]; ) that has uninitialized content.
This is usually no problem because dll_address_to_library_name fills the array, but on some codepaths it seems not to be the case.
See also this related sonar issue :
https://sonarcloud.io/project/issues?id=jdk&open=AXaE0drk8L9hkQskGEXZ&resolved=false&types=BUG
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2144/head:pull/2144$ git checkout pull/2144