|
Quick Lists
|
|
Bug ID:
|
4309152
|
|
Votes
|
8
|
|
Synopsis
|
# Compiler silently generates bytecode that exceeds VM limits
|
|
Category
|
java:compiler
|
|
Reported Against
|
1.3
, 1.4
, 1.1.3
, 1.1.6
, 1.2.1
, 1.2.2
, 1.3.1
, 1.2fcs
, kestrel
, 1.1beta3
, 1.2beta4
, 1.3.1_04
, merlin-beta3
|
|
Release Fixed
|
1.3.1_10
|
|
State
|
10-Fix Delivered,
Verified,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4029944
,
4060622
,
4067883
,
4071592
,
4185425
,
4204625
,
4225910
,
4303354
,
4353007
,
4414163
,
4641955
,
4692666
,
4743160
|
|
Submit Date
|
02-FEB-2000
|
|
Description
|
.The compiler does not properly enforce certain limits on the number or size
of various classfile components. This results in code that appears to compile
successfully, but fails at runtime during verification.
These were originally reported as separate bugs, which have now been closed
as duplicates of this one. The original bug numbers are included with each
item below.
1. The number of method arguments may not exceed 255. (4225910)
JDK 1.2 and JDK 1.3. Can cause a compiler crash (4692666).
2. This limit applies to constructor arguments as well. (4060622)
JDK 1.1.3 and JDK 1.3.
3. The number of constant pool entries is limited to 65535. (4185425)
JDK 1.3 only.
4. The number of dimensions in an array is limited to 255. (4067883)
JDK 1.1.3. Causes compile-time crash in JDK 1.3, so bug remains open.
5. The maximum size of the bytecodes for a method is 64k. (4204625)
JDK 1.1.6 and JDK 1.3. Reported not present in JDK 1.2.
6. There is a 64k limit on UTF-8 encoded strings. (4071592)
There are numerous xxxxx limits described in JVMS 2e 4.10 which are most
likely not being enforced by the compiler.
xxxxx@xxxxx 2000-02-01
I removed a completely unrelated program and stacktrace that has nothing
whatsoever to do with this bug, filed by skT88420 on 02/02/2000, review
ID: 100704.
This bug is for the internal use of the compiler team, to consolidate
reports of unchecked VM limits only. Please do not add additional items
to it -- file separate bugs, and we will add a reference here if needed.
xxxxx@xxxxx 2000-02-02
/*
An exception has occurred in the compiler (1.3.0rc2). Please file a bug at the J
ava Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include y
our program and the following diagnostic in your report. Thank you.
*/
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Display extends HttpServlet {
Connection con;
Statement st, st1, st2, st3;
String
strcategorycode, categorycode, jscategorycode, subcategorycode, scategorycode, code2;
int inthidden, intcategorycode, h3, h2;
public void init(ServletConfig config)
throws ServletException
{
super.init(config);
}
public void service(HttpServletRequest req, HttpServletResponse res)
throws
ServletException, IOException
{
res.setContentType("text/html");
ServletOutputStream sos = res.getOutputStream();
sos.print("<html><head><script language=\"javascript\">" +
"function click1()" +
"{ document.addcatform.h1.value=\"1\" " +
" }" +
"</script>" +
"</head><body bgcolor=lightblue><table width=\"100%\" align=\"center\" border=\"1\">");
sos.print("<tr><th>Item Name</th></tr>");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:shopcart");
st1 = con.createStatement();
String tempcategorycode = req.getParameter("code");
String hidden1 = req.getParameter("h2");
jscategorycode = tempcategorycode;
System.out.println("hideen value:" + hidden1);
System.out.println("code:" + jscategorycode);
if (hidden1 != null)
h3 = Integer.parseInt(hidden1);
subcategorycode = tempcategorycode.substring(0, h3);
int h4 = h3;
System.out.println("h4" + h4);
String concatcategorycode = subcategorycode + "%";
System.out.println("scode:" + subcategorycode);
System.out.println("ccode:" + concatcategorycode);
ResultSet rs = st1.executeQuery("select * from CategoryMaster where categorycode like '" + concatcategorycode + "'");
while (rs.next())
{
h2 = h3 + 2;
code2 = rs.getString(1);
if (code2.equals(jscategorycode) == false)
sos.print("<tr><td><a href=\"http://localhost:8080/servlet/Display?code=" + code2 + "&h2=" + h2 + "\">" + rs.getString("categoryname") + "</a></td></tr>");
}
st2 = con.createStatement();
ResultSet rs1 = st2.executeQuery("select * from CategoryMaster where categorycode like '" + tempcategorycode + "'");
// rs1.next();
// String dcategorycode=rs1.getString(1);
rs1.last();
// for(int ccode=0;ccode<
String dcategorycode = rs1.getString(1);
System.out.println("catcode:" + dcategorycode);
System.out.println("h3:" + h3);
System.out.println("h2:" + h2);
// strcategorycode=code2.substring(h3,h2);
System.out.println("sat");
// st3=con.createStatement();
// ResultSet rs2=st3.executeQuery("select count(*) from
// CategoryMaster where categorycode like '"
// String sub1categorycode=dcategorycode.substring(0,h2-2);
// String sub2categorycode=dcategorycode.substring(h2,12);
// String
// concat1categorycode=sub1categorycode+"%"+sub2categorycode;
// System.out.println("strcategorycode :"+strcategorycode);
String js1 = req.getParameter("h1");
// st3=con.createStatement("select * from CategoryMaster where categorycode
// String str1categorycode=rs2.getString(1);
// System.out.println("str1:"+str1categorycode);
if (js1 != null)
{
intcategorycode = Integer.parseInt(strcategorycode);
inthidden = Integer.parseInt(js1);
}
String incategoryname = req.getParameter("categoryname");
st = con.createStatement();
System.out.println("a1r");
if (inthidden == 1)
{
intcategorycode = intcategorycode + 1;
if (intcategorycode > 9)
{
scategorycode = subcategorycode + intcategorycode;
} else {
scategorycode = subcategorycode + "0" + intcategorycode;
}
System.out.println("scategorycode:" + scategorycode);
int lencategorycode = scategorycode.length();
System.out.println("lencategorycode" + lencategorycode);
for (int i = lencategorycode; i < 12; i = i + 1)
{
System.out.println("i:" + i);
categorycode = scategorycode + "0";
scategorycode = categorycode;
}
System.out.println("lencategorycode" + lencategorycode);
String s = "insert into CategoryMaster(categorycode,categoryname) values ('" + categorycode + "','" + incategoryname + "')";
System.out.println(s);
st.executeUpdate(s);
}
System.out.println("ar");
sos.print("</table>");
sos.print("<form onsubmit=\"click1()\" name=\"addcatform\" action=\"http://localhost:8080/servlet/Display\">" +
"<table><tr><td> Categoryname:<input type=\"text\" size=\"30\"name=\"categoryname\"></td></tr>" +
"<tr><td><input type=\"hidden\" value=\"0\" name=\"h1\"><inputtype=\"hidden\" value=\"2\" name=\"h2\">" +
"<input type=\"hidden\" name=\"code\" value=\"" + jscategorycode + "\"><td><tr>" +
"<tr><td> <input type=\"submit\" value=\"AddCategory\" name=\"AddCategory\" size=\"25\"></td></tr>" +
"</table></form></body></html>");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
/*
An exception has occurred in the compiler (1.3.0rc2). Please file a bug at the J
ava Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include y
our program and the following diagnostic in your report. Thank you.
java.lang.ClassFormatError: com/sun/tools/javac/v8/comp/Flow (Illegal constant p
ool index)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11
1)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:380)
at com.sun.tools.javac.v8.Main.compile(Main.java:247)
at com.sun.tools.javac.Main.main(Main.java:16)
*/
(Review ID: 109480)
======================================================================
raghunath.verabelli - 09/20/2001.
One of our Licensees (Sybase Inc) reported a program which compiles fine with 1.3, 1.3.1, 1.4-beta releases, but fails during the runtime with "Illegal constant pool type" error. However, with 1.2.2 the bug manifests itself as a compile-time bug rather than a runtime bug. They are encountering the error because they are hitting the hard limit on the length of a string constant.
I believe it should be caught during the compilation phase rather than runtime.
java SplashImage
Exception in thread "main" java.lang.ClassFormatError: SplashImage
(Illegal constant pool type)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
Attached is SplashImage.java file.
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
|
|
Work Around
|
N/A
|
|
Evaluation
|
All of these problems are present in JDK 1.3.0rc1-T.
xxxxx@xxxxx 2000-02-01
Note that sometimes the compiler can crash when these limits are exceeded.
See 4692666 for an example.
xxxxx@xxxxx 2002-05-29
|
|
Comments
|
Submitted On 20-JAN-2001
p.lavarre
I regret, but I believe, the jls/ does not require a Java
compiler to notice the limitations of what its binary can
represent.
In particular, I find the jls/ does not mention the
difficulty of separately compiling a constant initialiser
whose value cannot be represented in the binary. For a
vmspec/ binary, purportedly constant jls/ values that
cannot appear as a vmspec/ ConstantValue attribute include
null, division/remainder by zero, and String's whose UTF8
length exceeds xFFFF.
See bugs/4178182.html
Submitted On 04-JUN-2001
p.lavarre
bugs/4309152.html
> SAT JAN 20 02:27 P.M. 2001
> p.lavarre
> See bugs/4178182.html
Less concisely ...
For bugs re a seemingly constant expression whose
evaluation cannot be expressed as a JVM ConstantValue
attribute ...
See bugs/4178182.html re division by zero evaluation that
completes abruptly.
See bugs/4230296.html re evaluation that results in null.
See bugs/4353007.html
See bugs/4303354.html
See bugs/4071592.html re evaluation that results in a
String whose UTF8 length exceeds xFFFF.
As yes, the BugParade claims all of these bugs are
java:compiler bugs except for java:specification
bugs/4178182.html.
Submitted On 04-JUN-2001
p.lavarre
Fun to see so many of the Related Bugs have fallen into the
fathomless black pit of "Bug id ... is not available on the
Bug Parade at this time". Specifically:
bugs/4414163.html
bugs/4225910.html
bugs/4204625.html
bugs/4067883.html
Submitted On 04-JUN-2001
p.lavarre
(from bugs/4071592.html closed as a duplicate of this bug)
SUN JAN 21 06:08 A.M. 2001
p.lavarre
http://www.egroups.com/message/java-spec-report/111
repeats the rumour that, for people who compile Java for
the JVM, multithreaded initialisation without using a
jvm/ConstantValue attribute is problematic for any final
variable. Not just static. Not just not-private fields.
Not just fields.
Submitted On 03-JUL-2001
p.lavarre
See also bugs/4475252.html:
constant expr limits neglected by vmspec/ 4.10 Limitations
Submitted On 16-APR-2003
mallwitz
This is not fixed in java full version "1.4.1_02-b06"
Submitted On 14-MAR-2005
zcox123
This is still present in jdk1.4.1_07
Submitted On 16-MAR-2005
PeterAhe
This bug is fixed in 1.4.2. Please upgrade
your system.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |