File tree 3 files changed +18
-4
lines changed
deobfuscator-api/src/main/java/uwu/narumi/deobfuscator/api/helper
3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,11 @@ public static void registerInterpreter(MethodInterpreter interpreter) {
62
62
// Get value from stack
63
63
OriginalSourceValue sourceValue = stackValues .get (stackValues .size () - 1 );
64
64
if (sourceValue .getConstantValue () != null && sourceValue .getConstantValue ().value () instanceof String text ) {
65
- return OriginalSourceValue .ConstantValue .of (Integer .parseInt (text ));
65
+ try {
66
+ return OriginalSourceValue .ConstantValue .of (Integer .parseInt (text ));
67
+ } catch (NumberFormatException e ) {
68
+ return null ;
69
+ }
66
70
}
67
71
return null ;
68
72
}
@@ -79,7 +83,11 @@ public static void registerInterpreter(MethodInterpreter interpreter) {
79
83
OriginalSourceValue secondValue = stackValues .get (stackValues .size () - 1 );
80
84
if (firstValue .getConstantValue () != null && firstValue .getConstantValue ().value () instanceof String text &&
81
85
secondValue .getConstantValue () != null && secondValue .getConstantValue ().value () instanceof Integer radix ) {
82
- return OriginalSourceValue .ConstantValue .of (Integer .parseInt (text , radix ));
86
+ try {
87
+ return OriginalSourceValue .ConstantValue .of (Integer .parseInt (text , radix ));
88
+ } catch (NumberFormatException e ) {
89
+ return null ;
90
+ }
83
91
}
84
92
return null ;
85
93
}
Original file line number Diff line number Diff line change @@ -12,11 +12,14 @@ public class TestUniversalNumberTransformer {
12
12
}
13
13
}
14
14
15
- public void divideByZero () {
15
+ public void illegalOperations () {
16
16
int a = 2;
17
17
if (a == 0) {
18
18
int b = 9 / 0;
19
19
System.out.println(b);
20
+ System.out.println(Integer.parseInt("aaa"));
21
+ System.out.println(Float.parseFloat("bbb"));
22
+ System.out.println(Double.parseDouble("ccc"));
20
23
}
21
24
}
22
25
Original file line number Diff line number Diff line change @@ -13,12 +13,15 @@ public void testNumbers1() {
13
13
}
14
14
}
15
15
16
- public void divideByZero () {
16
+ public void illegalOperations () {
17
17
int a = 2 ;
18
18
if (a == 0 ) {
19
19
// Transformer shouldn't touch it
20
20
int b = 9 / 0 ;
21
21
System .out .println (b );
22
+ System .out .println (Integer .parseInt ("aaa" ));
23
+ System .out .println (Float .parseFloat ("bbb" ));
24
+ System .out .println (Double .parseDouble ("ccc" ));
22
25
}
23
26
}
24
27
You can’t perform that action at this time.
0 commit comments