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
8255542: Attribute length of Module, ModulePackages and other attributes is ignored #1407
Conversation
👋 Welcome back alanb! A progress list of the required criteria for merging this PR into |
@AlanBateman 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. |
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 okay.
@AlanBateman 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 10 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
|
||
long newPosition = in.count(); | ||
if (newPosition != (initialPosition + length)) { |
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.
should this be:
if ((newPosition - intialPosition) != length) {
just to make it clear that no overflow can happen?
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 attribute_length is a u4 so shouldn't arise but you are probably right that it would be clearer to reorganize it as you suggest.
|
||
@Override | ||
public String readUTF() throws IOException { | ||
return DataInputStream.readUTF(this); |
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.
If i understand correctly the code, I believe readUTF should change a boolean field named countCanNotBeTrackedAnymore
from false to true, and in the method count()
, countCanNotBeTrackedAnymore
has to be checked and throws an ISE before returning count
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.
Hi Rémi, I do not think that that is required. DataInputStream.readUTF
will call back into this
to do the reading so the count
should be properly incremented? Or maybe I'm missing something. Best regards!
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.
Thanks,
i should have read the code more carefully.
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 module-info is read sequentially so the constant pool is read (and indexed) before the attributes are read. So any references to UTF-8 constants doesn't involve random access. But maybe you mean something else?
/integrate |
@AlanBateman Since your change was applied there have been 30 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 2b4a423. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The attribute_length of known ModuleXXXX attributes in the module-info.class is currently ignored. It should be checked and the class rejected if the attribute length doesn't exactly match the length of the info in the attribute.
There are several ways to fix this. I initially limited the reading of the attribute_info to the attribute length but this resulted in confusing exception messages as the attribute appears truncated. The exception messages are clearer when it checks that the attribute length corresponds to the number of bytes read.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1407/head:pull/1407
$ git checkout pull/1407