diff options
author | Shigeru Chiba <chibash@users.noreply.github.com> | 2021-04-26 02:13:44 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-26 02:13:44 +0900 |
commit | 84c176a6e03fe56debdef02f7864d624c79f4d55 (patch) | |
tree | ef746e3bc9ba307b54d9717570a91e71acf9c63d /src/main/javassist/bytecode | |
parent | 0d468da4e95daeef7413c99a81b71d72eb8e7cad (diff) | |
parent | d2e757ee44c6425bd801b6f76ff14537203281b9 (diff) | |
download | javassist-84c176a6e03fe56debdef02f7864d624c79f4d55.tar.gz javassist-84c176a6e03fe56debdef02f7864d624c79f4d55.zip |
Merge pull request #351 from sgjesse/issue-350
This fixes Issue #350.
Check for extended frame type when updating StackMapTable offset.
Diffstat (limited to 'src/main/javassist/bytecode')
-rw-r--r-- | src/main/javassist/bytecode/StackMapTable.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/javassist/bytecode/StackMapTable.java b/src/main/javassist/bytecode/StackMapTable.java index 81622200..62a6aca0 100644 --- a/src/main/javassist/bytecode/StackMapTable.java +++ b/src/main/javassist/bytecode/StackMapTable.java @@ -204,8 +204,11 @@ public class StackMapTable extends AttributeInfo { } else if (type < 128) pos = sameLocals(pos, type); - else if (type < 247) - throw new BadBytecode("bad frame_type in StackMapTable"); + else if (type < 247) { + throw new BadBytecode( + "bad frame_type " + type + " in StackMapTable (pos: " + + pos + ", frame no.:" + nth + ")"); + } else if (type == 247) // SAME_LOCALS_1_STACK_ITEM_EXTENDED pos = sameLocals(pos, type); else if (type < 251) { @@ -890,11 +893,12 @@ public class StackMapTable extends AttributeInfo { match = oldPos <= where && where < position; if (match) { + int current = info[pos] & 0xff; int newDelta = offsetDelta + gap; position += gap; if (newDelta < 64) info[pos] = (byte)(newDelta + base); - else if (offsetDelta < 64) { + else if (offsetDelta < 64 && current != entry) { byte[] newinfo = insertGap(info, pos, 2); newinfo[pos] = (byte)entry; ByteArray.write16bit(newDelta, newinfo, pos + 1); |