8307855: update for deprecated sprintf for src/utils#13915
8307855: update for deprecated sprintf for src/utils#13915XueleiFan wants to merge 2 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back xuelei! A progress list of the required criteria for merging this PR into |
|
@XueleiFan The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
TobiHartmann
left a comment
There was a problem hiding this comment.
Looks good to me otherwise.
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. | |||
| 3* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. | |||
There was a problem hiding this comment.
| 3* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. | |
| * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. |
There was a problem hiding this comment.
Oops. Thank you for the catch!
|
@XueleiFan 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 44 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
Going to push as commit 4b0f421.
Your commit was automatically rebased without conflicts. |
|
@XueleiFan Pushed as commit 4b0f421. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
kimbarrett
left a comment
There was a problem hiding this comment.
A couple of issues noticed after this PR has been integrated.
| const decode_func_vtype decode_func_virtual_address = &decode_instructions_virtual; | ||
| const decode_func_stype decode_func_address = &decode_instructions; | ||
|
|
||
| #define remaining_buflen(buf, bufsize, p) ((bufsize) - ((p) - (buf))) |
There was a problem hiding this comment.
This shouldn't be a macro. Among other reasons, see the style guide.
There was a problem hiding this comment.
May I have an reference to the style guide?
Never mind, I found it in the doc. Thanks!
| if (delays) sprintf(p += strlen(p), " delay='%d'", delays); | ||
| if (type) snprintf(p += strlen(p), remaining_buflen(buf, bufsize, p), " type='%s'", type); | ||
| if (dsize) snprintf(p += strlen(p), remaining_buflen(buf, bufsize, p), " dsize='%d'", dsize); | ||
| if (delays) snprintf(p += strlen(p), remaining_buflen(buf, bufsize, p), " delay='%d'", delays); |
There was a problem hiding this comment.
What is the value for p that is used in the call to remaining_buflen?
It is being assumed to be the value after the assignment by the first
argument. However, according to the standard, it is unspecified, and
the whole snprintf call invokes UB. This is because there aren't any
sequence points between the update of p in the first argument and that
reference. (C++17 changes this, but we aren't using C++17 yet.)
There was a problem hiding this comment.
I missed the point that the buffer is not empty, and has been used. Thank you very much!
|
The change is also missing a second review. I'm backing it out for now with #13975. Let's redo with JDK-8308071. Thanks, |
Thanks! |
Hi,
May I have this update reviewed?
The sprintf is deprecated in Xcode 14, and Microsoft Virtual Studio, because of security concerns. The issue was addressed in JDK-8296812 for building failure, and JDK-8299378/JDK-8299635/JDK-8301132 for testing issues . This is a break-down update for sprintf uses in the src/utils directory.
Thanks,
Xuelei
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13915/head:pull/13915$ git checkout pull/13915Update a local copy of the PR:
$ git checkout pull/13915$ git pull https://git.openjdk.org/jdk.git pull/13915/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13915View PR using the GUI difftool:
$ git pr show -t 13915Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13915.diff
Webrev
Link to Webrev Comment