diff options
author | chibash <chiba@javassist.org> | 2022-08-07 04:06:50 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2022-08-07 04:06:50 +0900 |
commit | 3528a20dd925388c01330b950d0f3ad75f7a14e5 (patch) | |
tree | a91523fb9843d8c9a6e86364ab005f55f6b295fa /src/test/javassist/JvstTest5.java | |
parent | 4f35e4e1a8c76fa7da07a92674ffddd5c4c27ec0 (diff) | |
download | javassist-3528a20dd925388c01330b950d0f3ad75f7a14e5.tar.gz javassist-3528a20dd925388c01330b950d0f3ad75f7a14e5.zip |
prohibits too many items from being added to a constant pool.
the previous commit was wrong.
Diffstat (limited to 'src/test/javassist/JvstTest5.java')
-rw-r--r-- | src/test/javassist/JvstTest5.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/test/javassist/JvstTest5.java b/src/test/javassist/JvstTest5.java index 39af16b9..4a370632 100644 --- a/src/test/javassist/JvstTest5.java +++ b/src/test/javassist/JvstTest5.java @@ -580,8 +580,13 @@ public class JvstTest5 extends JvstTestRoot { CtClass cc = sloader.makeClass("TooManyConstPoolItems"); ClassFile cf = cc.getClassFile(); ConstPool cPool = cf.getConstPool(); - for (int i = 0; i <= 65527; i++) - cPool.addIntegerInfo(i); + int size = cPool.getSize(); + while (cPool.getSize() < 65536 - 6) + cPool.addIntegerInfo(cPool.getSize()); + + cc.writeFile(); + cc.defrost(); + cPool.addIntegerInfo(-1); try { cc.writeFile(); fail("too many items were accepted"); |