-
Notifications
You must be signed in to change notification settings - Fork 543
8335216: [windows] Missing error check for GetSystemDirectory in glass #1498
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
8335216: [windows] Missing error check for GetSystemDirectory in glass #1498
Conversation
|
👋 Welcome back lkostyra! A progress list of the required criteria for merging this PR into |
|
@lukostyra 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 |
|
I'll review this. @mstr2 Would you like to be the second reviewer? /reviewers 2 |
|
@kevinrushforth |
mstr2
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.
I've checked the specification of GetSystemDirectoryW and wcscat_s. The patch will correctly catch failure cases.
kevinrushforth
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.
Looks good. I ran a quick sanity test as well.
|
/integrate |
|
Going to push as commit 56e07db. |
|
@lukostyra Pushed as commit 56e07db. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When GetSystemDirectory does not have enough space to output a path to Windows' system directory, it will return a different value than 0 (more notably, the amount of bytes actually needed including null terminator). This was not checked, so the very rare hypothetical situation where Windows' system directory is different than the "standard"
C:\Windowsand longer than MAX_PATH was not properly handled.For now I simply changed the code to print an error and exit. This could be improved further to instead dynamically allocate space for the system directory though.
Other changes, also mentioned in the issue:
wchar_texplicitly here, so I changedGetSystemDirectorytoGetSystemDirectoryWto ensure the code compiles even without UNICODE being definedwcscat_scan potentially fail for the same reasons as above, so this situation is also handled now.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1498/head:pull/1498$ git checkout pull/1498Update a local copy of the PR:
$ git checkout pull/1498$ git pull https://git.openjdk.org/jfx.git pull/1498/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1498View PR using the GUI difftool:
$ git pr show -t 1498Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1498.diff
Webrev
Link to Webrev Comment