DO NOT REPLY [Bug 18323] - Size of LDC_W's operand can be incorrect

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=18323>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18323

Size of LDC_W's operand can be incorrect





------- Additional Comments From [email protected]  2004-05-13 14:19 -------
One example is the JDK 1.4 compiled java.math.BigInteger.  If you run:
  `javap -c java.math.BigInteger | grep ldc_w`
you will find several examples of LDC_W operands with sub-256 indices:
   401: ldc_w   #268; //int 2147483647
   1835:        ldc_w   #435; //String 0000000[..]
   2691:        ldc_w   #259; //int 1162261467
   2702:        ldc_w   #260; //int 1220703125
   2709:        ldc_w   #247; //int 362797056
   2716:        ldc_w   #267; //int 1977326743
   2729:        ldc_w   #248; //int 387420489
   2736:        ldc_w   #258; //int 1000000000
    ...
Without the above patch, a BCEL lifted and regenerated BigInteger will generate
the following broken classfile:
   434: ldc_w   #268; //int 2147483647
   1868:        ldc_w   #435; //String 0000000[..]
   2724:        ldc_w   #259; //int 1162261467
   2735:        ldc_w   #260; //int 1220703125
   2742:        ldc_w   #63311; //BOGUS_TAG:100 <Incorrect CP index:63311>
   2748:        ldc_w   #267; //int 1977326743
   2761:        ldc_w   #63567; //BOGUS_TAG:100 <Incorrect CP index:63567>
   2767:        ldc_w   #258; //int 1000000000
    ...
Note that 63311 = 247*256 + 79, and the instruction following the ldc_w is an
iastore (opcode 79).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.