-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8289697: buffer overflow in MTLVertexCache.m: MTLVertexCache_AddGlyphQuad #9368
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 vkempik! A progress list of the required criteria for merging this PR into |
|
@VladimirKempik The following label 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 list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
|
Looks good for me |
|
Linux test failure unrelated, this commit changes only macos's code |
aghaisas
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.
This is a good catch and fix.
There is another place in this file where MTLVC_ADD_TRIANGLES is used.
Although it is a corner case, it is worth adding the check for additional 6 vertices at that place as well.
Adding a separate check at the beginning of the MTLVertexCache_AddMaskQuad method where there is a check for maskCacheIndex seems logical to me. What do you think?
|
Added one more check into MTLVertexCache_AddMaskQuad, to the first if condition. |
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.
Are there any other cases like this ? We should look around. (PS I see Ajit asked the same question and perhaps even answered it !)
Did you find this by inspection or did you hit it ?
Can we use a defined constant instead of "6" ?
I hit this bug when running IDEA on asan-enabled build of ojdk ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6210011b94a8 at pc 0x0001707b9c0e bp 0x70001358e8f0 sp 0x70001358e8e8
#define TRI_IN_VERT 6 ? |
|
I will submit a full test run with this patch and then approve on it's successful completion. |
src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m
Outdated
Show resolved
Hide resolved
aghaisas
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 full test run is good with this change.
2 comments in the code still use MTL_TRIS_IN_VERTEX. These need to be corrected.
src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m
Outdated
Show resolved
Hide resolved
src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m
Outdated
Show resolved
Hide resolved
|
Yeah, missed that, thanks for noticing |
There is one instance of |
prrace
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.
LGTM although I'd really (really!) like you to break up those long lines before pushing.
|
@VladimirKempik 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 482 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 |
|
/reviewer credit aghaisas |
|
@VladimirKempik Reviewer |
|
/integrate |
|
Going to push as commit d852e99.
Your commit was automatically rebased without conflicts. |
|
@VladimirKempik Pushed as commit d852e99. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review this simple patch. When running idea on jdk17 with asan I have found this buffer overflow.
The code checks the cache for at least one free element, while placing 6 elements to the cache.
The fix checks the presence of 6 free elements.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9368/head:pull/9368$ git checkout pull/9368Update a local copy of the PR:
$ git checkout pull/9368$ git pull https://git.openjdk.org/jdk pull/9368/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9368View PR using the GUI difftool:
$ git pr show -t 9368Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9368.diff