Commit Graph
6 Commits
Author SHA1 Message Date
BFlat 18e2c3bc84 Merge pull request #2118 from dotCooCoo/fix/java-class-string-budget
java-class: bound the constant-pool text copied into names
2026-11-26 10:32:14 +07:00
dotCooCoo 4d9e5aa138 java-class: keep a constant's rendered length by the Utf8 it copies
Names::keep kept the rendered length by the constant's own pool index.
Many ConstantValue attributes that point at distinct String constants
over one long Utf8 each rendered that Utf8 again before the budget
refused it. String, Class and MethodType constants now share the kept
length of the Utf8 they copy, so its text is built at most once past
the budget.
2026-11-24 04:58:39 -08:00
dotCooCoo 946baeef47 java-class: render a constant value only when the budget covers it
Names::keep now takes the render function and records the length of each
text it builds by kind and pool index. A text already measured is rendered
again only when the budget admits it, so fields that repeat one large
string constant no longer build that string for every placeholder.
2026-11-23 23:53:47 -08:00
dotCooCoo acfb5fc329 java-class: bound the constant-pool text copied into names
Interfaces, field and method names and descriptors, signatures, constant
values, thrown and caught types, inner classes and annotation types each
copy their constant-pool text. Many entries can name one 65,535-byte Utf8,
so a class file under 100 KiB could make parse() copy gigabytes.

parse() now copies at most 64 MiB of such text per class. Past that,
names are kept as pool-index placeholders (<class#2>, <utf8#1>) and a
warning is added; every row is still listed.
2026-11-17 14:38:14 -08:00
Dylan M. Taylor 65e38419d7 testkit: share the sampled-damage corpus with WASM and Java class 2026-11-17 16:44:09 -05:00
d118983bf9 Extract Java class reader and JVM opcode decoder (#2048)
* Port Java class source: Craft Anything

Source: storytold/craft-anything@f64ae3bf3c

* Port Java class source: Find class usage in multidimensional object arrays (R0.5) (#437)

Source: storytold/craft-anything@ffe15c9165

* Port Java class source: More format parsers keep to their declared lengths and refuse impossible values (#722)

Source: storytold/craft-anything@b9ca099903

* Port Java class source: Address the parser review findings from #722 (#766)

Source: storytold/craft-anything@eab6a0f01b

* Port Java class source: Read JVM method parameters containing parentheses in class names (R3.12) (#1342)

Source: storytold/craft-anything@fb4c437fe6

* Port Java class source: Reject Java constants that exceed the constant-pool slots (R3.12) (#1373)

Source: storytold/craft-anything@1c4f233f08

* Port Java class source: Validate JVM switch tables before allocating decoded pairs (R3.12) (#1503)

Source: storytold/craft-anything@b40c56ef5c

* Port Java class source: Reuse constant-pool names while reading Java attributes (R3.12) (#1549)

Source: storytold/craft-anything@76fcdaadb7

* Port Java class source: Trace JVM bootstrap dependencies at their bytecode use sites (R3.12) (#1648)

Source: storytold/craft-anything@c5e524dd08

* Port Java class source: Reject impossible JVM array allocation operands (R3.12) (#1675)

Source: storytold/craft-anything@f04d7456e0

* Port Java class source: Report truncated Java class attribute tables (R3.12)

Source: storytold/craft-anything@420552ff74

* Expose neutral Java class API and retain checked reader and synthetic fixtures

* Retain Java regression: java_array_operands

Source: storytold/craft-anything@f04d7456e0

* Retain Java regression: java_attribute_names

Source: storytold/craft-anything@76fcdaadb7

* Retain Java regression: java_constant_pool_slots

Source: storytold/craft-anything@1c4f233f08

* Retain Java regression: java_invoke_operands

Source: storytold/craft-anything@eab6a0f01b

* Retain Java regression: java_linkage_references

Source: storytold/craft-anything@c5e524dd08

* Retain Java regression: java_truncated_attributes

Source: storytold/craft-anything@420552ff74

* Retain Java regression: java_wide_opcodes

Source: storytold/craft-anything@b9ca099903

* Register Java class reader and retain source regression coverage

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com>
Co-authored-by: BFlat <bombayapirat@gmail.com>
Co-authored-by: Afloat <ShuffleMonkey@163.com>
Co-authored-by: RRFZ <247457381+Plastic-time@users.noreply.github.com>
2026-11-17 16:13:18 -05:00