8288759: GCC 12 fails to compile signature.cpp due to -Wstringop-overread #49
8288759: GCC 12 fails to compile signature.cpp due to -Wstringop-overread #49
Conversation
👋 Welcome back shade! A progress list of the required criteria for merging this PR into |
Webrevs
|
Any takers? :) |
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.
Seems fine.
@shipilev 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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
Thanks! @kimbarrett, want to take a look as well? |
@kimbarrett, @coleenp -- I redid the fix to fix the actual warning instead. I opted to 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.
The proposed fix seems plausible, and addresses the warning. I was a little worried that someone might come along later and try to change it to just
assert(end < limit, "invalid type");
but presumably that will get the warning again during testing.
I tried to think of a less contrived way to write this while still addressing the warning. I haven't come up with anything better, assuming returning limit is okay.
But I'm entirely unfamiliar with the signature code, so don't know if returning limit is okay. So don't count me as a reviewer for this change (and I won't hit the Approve button).
Closed in favor of openjdk/jdk#9711 |
Trying to compile with GCC 12.1.1 (current Fedora Rawhide) yields this failure:
As @kimbarrett says: "The warning is indicating an actual problem with the code. The while loop on line 338 may terminate with end == limit if the string consists of just a sequence of '[' and then ends. If the loop ends for that reason, we later read base[limit], invoking UB as limit is the length of base."
Additional testing:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk19 pull/49/head:pull/49
$ git checkout pull/49
Update a local copy of the PR:
$ git checkout pull/49
$ git pull https://git.openjdk.org/jdk19 pull/49/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 49
View PR using the GUI difftool:
$ git pr show -t 49
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/49.diff