mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-22 12:51:01 +00:00
6882235: invalid exponent causes silent javac crash
Reviewed-by: darcy
This commit is contained in:
parent
e851626bac
commit
8a6e77c436
@ -593,7 +593,7 @@ public class JavacParser implements Parser {
|
||||
//where
|
||||
boolean isZero(String s) {
|
||||
char[] cs = s.toCharArray();
|
||||
int base = ((Character.toLowerCase(s.charAt(1)) == 'x') ? 16 : 10);
|
||||
int base = ((cs.length > 1 && Character.toLowerCase(cs[1]) == 'x') ? 16 : 10);
|
||||
int i = ((base==16) ? 2 : 0);
|
||||
while (i < cs.length && (cs[i] == '0' || cs[i] == '.')) i++;
|
||||
return !(i < cs.length && (Character.digit(cs[i], base) > 0));
|
||||
|
||||
14
langtools/test/tools/javac/T6882235.java
Normal file
14
langtools/test/tools/javac/T6882235.java
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6882235
|
||||
* @summary invalid exponent causes silent javac crash
|
||||
*
|
||||
* @compile/fail T6882235.java
|
||||
* @compile/fail/ref=T6882235.out -XDrawDiagnostics T6882235.java
|
||||
*/
|
||||
|
||||
class T6882235 {
|
||||
int i = ; // invalid expression
|
||||
float f = 0e*; // invalid exponent, should not crash compiler
|
||||
int j = ; // invalid expression
|
||||
}
|
||||
5
langtools/test/tools/javac/T6882235.out
Normal file
5
langtools/test/tools/javac/T6882235.out
Normal file
@ -0,0 +1,5 @@
|
||||
T6882235.java:11:13: compiler.err.illegal.start.of.expr
|
||||
T6882235.java:12:15: compiler.err.malformed.fp.lit
|
||||
T6882235.java:12:18: compiler.err.illegal.start.of.expr
|
||||
T6882235.java:13:13: compiler.err.illegal.start.of.expr
|
||||
4 errors
|
||||
Loading…
x
Reference in New Issue
Block a user