Hi

I found a bug in BCEL 5.1

It's only triggered if someone uses LDC_W with an offset of < 256.
There's no reason to do that, but Sun do it anyway in 
java/math/BigInteger.class from 1.4.2 (in rt.jar).

In LDC_W.initFromFile(ByteSequence, boolean) the the opcode is
set to LDC_W, but the length isn't changed.  This means when
I call getMethod on the MethodGen object I get the wide opcode
but only two bytes are reserved.  Chaos ensues.

This fixes it for me, I'm not sure it's the right solution:

--- bcel-5.1/src/java/org/apache/bcel/generic/LDC_W.java        2003-04-25 
09:06:16.000000000 +0200
+++ ../speciale/jdfa/src/org/apache/bcel/generic/LDC_W.java     2004-04-05 
20:25:38.000000000 +0200
@@ -84,5 +84,7 @@
     setIndex(bytes.readUnsignedShort());
     // Override just in case it has been changed
     opcode = org.apache.bcel.Constants.LDC_W;
+    // Even if the index is < 256 the length of LDC_W is still 3
+    length = 3;
   }
 }

-- 
Erik Corry         I'd be a Libertarian, if they weren't all a
[EMAIL PROTECTED]     bunch of tax-dodging professional whiners.   - B. Breathed.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to