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
8264666: Change implementation of safeAdd/safeMult in the LCMSImageLayout class #3333
Conversation
👋 Welcome back serb! A progress list of the required criteria for merging this PR into |
The nice PR number: 3333! |
if (l.nextRowOffset == l.width * 4 * intRaster.getPixelStride()) { | ||
l.imageAtOnce = true; | ||
} | ||
} while (false); |
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.
Any idea why the "do/while(false)" was used here?
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 can only guess it was just style ..
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.
Probably it is just a way to highlight and improve readability of a block of code, but simply {}
would be enough in this case.
Webrevs
|
I don't understand the exception handling here. multiplyExact and addExact will throw a runtime exception - ArithmeticException. And I don't see where it is caught. The change for ImageLayoutException to extend ArithmeticException doesn't seem like it can help here. Where is the ArithmeticException being turned into ImageLayoutException ? |
O_o for some reason... missed that. |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
4 similar comments
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
5 similar comments
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@mrserb This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
I think the usage of these methods in this class is wrong. Both allow negative values which should not be accepted. |
The fix is reworked based on the new facts about that methods. |
if (l.nextRowOffset == l.width * 4 * intRaster.getPixelStride()) { | ||
l.imageAtOnce = true; | ||
} | ||
} while (false); |
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 can only guess it was just style ..
@mrserb 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 64 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 40f19c0.
Your commit was automatically rebased without conflicts. |
Description of the new version of the fix:
While I have worked on this change and tried to consider the comments, I have found that the usages of the "safeAdd/safeMult" in the LCMSImageLayout class are incorrect. Both methods are based on the "Math" versions but throw a different exception. The problem is that its implementation may accept the negative values during intermediate calculation, see the old implementation of "verify" method:
I wondered is it possible to provide some data that using wrong/negative data at step2 may result in the correct check at step3. I spent some time and was able to reproduce the problem with the attached test case. Note that the test is a little bit cryptic since it is not possible to reproduce it by input image data.
Note: I have removed all cleanup from the fix, to make it simpler.
<======>
Description of the old version of the fix:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3333/head:pull/3333
$ git checkout pull/3333
Update a local copy of the PR:
$ git checkout pull/3333
$ git pull https://git.openjdk.java.net/jdk pull/3333/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3333
View PR using the GUI difftool:
$ git pr show -t 3333
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3333.diff