RFR: 8255542: Attribute length of Module, ModulePackages and other attributes is ignored

Alan Bateman alanb at openjdk.java.net
Wed Dec 2 18:32:01 UTC 2020


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.

-------------

Commit messages:
 - Merge
 - Merge
 - Trailing whitespace
 - Expand test to Module attribute
 - Merge
 - Test cleanup
 - Add test
 - Merge
 - Reject classes with attribute length that doesn't match actual

Changes: https://git.openjdk.java.net/jdk/pull/1407/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1407&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8255542
  Stats: 566 lines in 8 files changed: 562 ins; 1 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1407.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1407/head:pull/1407

PR: https://git.openjdk.java.net/jdk/pull/1407


More information about the core-libs-dev mailing list