!"#$%&'()*+,$-$"+)'$.$ !"#$/()0$123'04$ 5*,,04$6*330)$ 1'0,,078(39:$;7*<0)3*'2$ =(3'$(>$':0$3,*?03$82$"0'0)$=0:,*'@$
A<0)<*0B$ • CD+4E,03$ • 5:+'$*3$!"#F$ • CD'07?*7G$!"#$ – H*3'070)3$ – I2'09(?0$#+9'()*03$ – =(?0,$9,+3303$ • J0K7G$3'+)'0?$ – L(B7,(+?M$N73'+,,$+7?$O&7$P*7$C9,*E30Q$ • J((G,0$1&440)$(>$/(?0$
5:+'$*3$!"#F$ 3&)E)*3*7G,2$:+)?$'($3&44+)*@0$-$9+7$80$&30?$>()$4+72$':*7G3$ • 0D'073*8,0$<*)'&+,$4+9:*70$>)+40B()R$>()$!+<+$82'09(?0$<0)*S9+T(7U$ • B()R8079:$'($0V9*07',2$*4E,0407'$+,,$R*7?3$(>$<0)*S9+T(7$'((,3$ '2E*9+,$&30$9+303U$$ • – 3(WB+)0$4(?0,$9:09R*7G$P?0+?,(9R$X$)+90$?0'09T(7Q$ – ?00E$*73E09T(7$P7&40)*9$+7+,23*3M$*7<+,*?$+99033Q$ – '03'$9+30$G070)+T(7$P3248(,*9$0D09&T(7Q$ – YYY$+7?$4+72$4()0$$
Z*3'()2$(>$!"#$ • 7('$+$70B$E)([09'U$+)(&7?$>()$.\$20+)3$+7?$ 9(7T7&(&3,2$?0<0,(E0?U$ – .]]]$-$E)([09'$3'+)'0?$+3$>)(7'$07?$>()$1E*7$4(?0,$9:09R0)$ – ^\\\$-$)0*4E,0407'+T(7$+3$9(79)0'0$<*)'&+,$4+9:*70$>()$ 3(WB+)0$4(?0,$9:09R*7G$P9(79&))0792$?0>09'3Q$ – ^\\_$-$*7')(?&9T(7$(>$0D'073*(7$*7'0)>+903$ – ^\\`$-$(E07$3(&)90?$(7$1(&)90>()G0$ – ^\\a$-$E+)T9*E+T(7$*7$J((G,0$1&440)$(>$/(?0$ – ^\\]$-$4(<0?$'($(B7$30)<0)M$:(3T7G$0D'073*(7$E)([09'3$ +7?$5*R*$$
;30)3F$ 4+[()$&30)$G)(&E$*3$+9+?04*9$)030+)9:$-$9(,,+8()+T(73$B*':$b^\$ • &7*<0)3*T03$B(),?B*?0$P&*&9Y0?&M$&7,Y0?&M$82&Y0?&M$&47Y0?&M$1'0,,078(39:$ c+M$5+'0),(($/+M$dN1%$!EM$/:+),03$;7*<0)3*'2$")+G&0$/@M$YYQ$ 9(4E+7*03$7('$3($(&'3E(R07$P0D90ET(7$#&[*'3&$-$300$E)033$)0,0+303M$0YGY$ • :eEUffBBBY>&[*'3&Y9(4fG,(8+,f70B3fE)f+)9:*<03f4(7':f ^\.\f^\.\\..^-\^Y:'4,Q$M$8&'$&30?$82$30<0)+,$#()'&70$`\\$9(4E+7*03$ ,('3$(>$P4(3',2Q$+7(724(&3$+7?$E)*<+'0$&30)3$Pg.\\\$:*'3f?+2$(7$B083*'0M$ • g.\$?(B7,(+?3f?+2M$gh\$)0+?$')+73+9T(73f?+2M$*7*T+,,2$h\\\$?(B7,(+?3f 4(7':Q$ 4+72$&303$*73*?0$id1dM$8&'$4(3',2$4(?0,$<0)*S9+T(7$+'$d403$O030+)9:$ • /07'0)$
dB+)?3$ • B*?0,2$)09(G7*@0?M$+B+)?3$>()$!"#$*7$G070)+,$+7?$>()$ )0,+'0?$B()RM$'0+4$+7?$*7?*<*?&+,3$ – ^\\_$-$j%&)7*7G$J(+,3$*7'($O0+,*'2k$P%JNOQ$C7G*700)*7G$ N77(<+T(7$dB+)?$>)(4$':0$AV90$(>$d0)(1E+90$ %09:7(,(G2$ – ^\\lM$^\\`$-$d403$/(7')+9'()$/(&79*,$dB+)?3$ – ^\\m$-$NI=n3$Z+*>+$60)*S9+T(7$/(7>0)0790$PZ6/Q$+B+)?$ – ^\\]$-$jA&'3'+7?*7G$%09:7(,(G2$L0<0,(E407'k$+B+)?$(>$ ':0$#0?0)+,$H+8()+'()2$/(73()T&4$>()$%09:7(,(G2$%)+73>0)$ P#H/Q$
i($#)00$H&79:$ • 2(&$700?$'($,0+)7$ – !"#$*3$7('$+$,*G:'B0*G:'$'((,$ – o0D*8*,*'2$:+3$*'3$E)*90$-$9(7SG&)+T(7$9+7$80$*7T4*?+T7G$ – 4*G:'$)0p&*)0$0D'073*(7$>()$2(&)$1;%$PE)(E0)T03M$,*8)+)*03Q$ • 2(&$B*,,$079(&7'0)$&7*4E,0407'0?f4*33*7G$E+)'3$ P0YGY$;73+T3S0?H*7RC))()Q$ – &3&+,,2$0+32$'($*4E,0407'$ – 0D90ET(7U$3'+'0-)0,0<+7'$7+T<0$,*8)+)*03$P[+<+Y*(M$[+<+Y70'Q$ – 9+7$80$0*':0)$4(?0,0?$()$3'&880?$ • 2(&$700?$3&*'+8,0$'03'$?)*<0)3$
!"#q3$Z(40$ :eEUff8+80,S3:Y+)9Y7+3+YG(<f')+9f[E>$ !"#q3$;30)$#()&4$ :eEUffG)(&E3YG((G,0Y9(4fG)(&Ef[+<+-E+':S7?0)$
5:0)0$'($,0+)7$4()0$-$':0$!"#-5*R*$ 9 �
r02$"(*7'3$ • !"#$*3$)030+)9:$E,+s()4$ !"# $E)(?&9T(7$'((,$P8+3*3Q$ • !"#$*3$?03*G70?$>()$0D'073*8*,*'2$ • !"#$*3$(E07$3(&)90$ • !"#$*3$+7$(7G(*7G$9(,,+8()+T<0$?0<0,(E407'$E)([09'$$ • !"#$9+77('$S7?$+,,$8&G3$ $$$$$-$8&'$+3$(>$'(?+2$-$ $$$$$$$$$$$3(40$(>$':0$4(3'$0DE073*<0$8&G3$(7,2$!"#$9+7$S7?$ • !"#$*3$4(?0)+'0,2$3*@0?$323'04$Pg^\\R3,(9$9()0$t$0D'073*(73Q$ • !"#$)0E)0307'3$b^\$4+7$20+)$?0<0,(E407'$0u()'$ • !"#$*3$E&)0$!+<+$+EE,*9+T(7$PE,+s()4$*7?0E07?07'Q$
dEE,*9+T(7$%2E03$ 11 �
CD+4E,03$ • 3(WB+)0$4(?0,$9:09R*7G$P1=/Q$(>$E)(?&9T(7$9(?0$ – ?+'+$+9p&*3*T(7$P)+7?(4M$&30)$*7E&'Q$ – 9(79&))0792$P?0+?,(9RM$)+903Q$ @Const ?00E$*73E09T(7$(>$E)(?&9T(7$9(?0$ • int dontChangeMe() {..} – E)(E0)'2$+77('+T(73$P/(73'M$"8/MYYQ$ – 7&40)*9$<0)*S9+T(7$P(<0)o(BM$9+790,,+T(7Q$ double x = (y - z) * c numeric error of x? 4(?0,$<0)*S9+T(7$ • – ;=H$3'+'09:+)'3$ '03'$9+30$G070)+T(7 $ •
!"#$+7?$':0$Z(3'$!6=$ • <0)*S0?$!+<+$E)(G)+4$*3$0D09&'0?$82$!"#M$B:*9:$*3$+$<*)'&+,$ 4+9:*70$*4E,0407'0?$*7$!+<+M$*Y0Y$)&73$(7$'(E$(>$+$:(3'$!6=$ ⇒ $0+32$'($G0'$9(7>&30?$+8(&'$B:($0D09&'03$B:+'$
!"#$1')&9'&)0$
L*)09'()2$$ 1')&9'&)0$ +,,$!"#$E)([09'3$3:+)0$ • &7*>()4$?*)09'()2$,+2(&'$ 8*7+)2$?*3')*8&T(73$+)0$ • 3,*903$(>$3(&)90$ ?*3')*8&T(73$ P*7'0)9:+7G0+8,0Q$ _)?$E+)'2$'((,3$X$,*8)+)*03$ • 9+7$80$*79,&?0?$P30,>- 9(7'+*70?Q$ +,,$E)([09'3$:+<0$0D+4E,03$ • +7?$)0G)033*(7$'03'$3&*'03$ P0<07'&+,,2$ � Q$ E)([09'3$:+<0$(&'-(>-':0- • 8(D$ NLC$9(7SG&)+T(7$ PiIMC9,*E30Q$
!"#$%(E-,0<0,$1')&9'&)0$ • 'B($4+[()$9(73')&9'3U$ 10+)9:$+7?$!6=$ • !6=$E)(?&903$$ E)(G)+4$$ 3'+'03$ • 10+)9:$*3$':0$$ !6=$?)*<0)$
10+)9:$"(,*9*03$ • 3'+'0$0DE,(3*(7$4*TG+T(7U$30+)9:$':0$*7'0)03T7G$3'+'0$3E+90$E+)'$ S)3'$PjG0'$'($':0$8&G$0+),2M$80>()0$)&77*7G$(&'$(>$404()2kQ$ • 10+)9:$*73'+7903$079+E3&,+'0$P9(7SG&)+8,0Q$30+)9:$E(,*9*03$
CDE,()*7G$/:(*903$ • 4(?0,$9:09R0)$700?3$9:(*903$'($0DE,()0$3'+'0$3E+90$ • ':0)0$+)0$4+72$E('07T+,$'2E03$(>$9:(*903$P39:0?&,*7GM$?+'+M$YYQ$ • 9:(*90$'2E03$3:(&,?$7('$80$:+)?B*)0?$*7$4(?0,$9:09R0)$
/:(*90$J070)+'()3$ • ')+73*T(73$80G*7$B*':$+$9:(*90$+7?$0D'07?$&7T,$':0$70D'$ /:(*90J070)+'()$P/JQ$*3$30'$P82$*73')&9T(7M$7+T<0$E00)$()$,*3'070)Q$ • +?<+790$E(3*T(73$':0$/J$(7$':0$70D'$&7E)(90330?$9:(*90$P*>$+72Q$ • 8+9R')+9R$G(03$&E$'($':0$70D'$/J$B*':$&7E)(90330?$9:(*903$ • /:(*90$J070)+'()3$+)0$9(7SG&)+8,0$+3$B0,,M$*Y0Y$9)0+'0$2(&)$(B7$
H*3'070)3M$':0$!"#$",&G*73$
H*3'070)3$N4E,0407'+T(7$
CD+4E,0$H*3'070)$ /:09R*7G$i(7i&,,$d77('+T(7$(7$O0'&)7$ public class NonnullChecker extends ListenerAdapter { ... public void executeInstruction (JVM vm) { Instruction insn = vm.getLastInstruction(); ThreadInfo ti = vm.getLastThreadInfo(); if ( insn instanceof ARETURN ) { // check @NonNull method returns ARETURN areturn = (ARETURN)insn; MethodInfo mi = insn.getMethodInfo(); if ( areturn.getReturnValue(ti) == null ) { if ( mi.getAnnotation(“java.annotation.Nonnull”) != null ) { Instruction nextPc = ti.createAndThrowException( "java.lang.AssertionError", "null return from @Nonnull method: " + mi.getCompleteName()); ti.setNextPC(nextPC); return; } } ...
I2'09(?0$N73')&9T(7$#+9'()*03$
CD+4E,0$v$I2'09(?0$#+9'()2$ • E)(<*?0$+,'0)7+T<0$N73')&9T(7$9,+3303$>()$)0,0<+7'$82'09(?03$ • 9)0+'0$X$9(7SG&)0$N73')&9T(7#+9'()2$':+'$*73'+7T+'03$':04$ compiler ! ... � [20] iinc � [21] goto 10 � void notSoObvious(int x){ � [10] iload_4 � int a = x*50; � [11] bipush � int b = 19437583; � [12] if_icmpge 22 � int c = a; � JPF configuration ! [13] iload_3 � for (int k=0; k<100; k++){ � [14] iload_2 � c += b; � vm.insn_factory.class = � [15] iadd � System.out.println(c); � .numeric.NumericInstructionFactory � ... � }} � ... � notSoObvious(21474836); � class loading ! code execution ! (by JPF) ! class IADD extends Instruction { Instruction execute (.., ThreadInfo ti) { int v1 = ti.pop(); int v2 = ti.pop(); int res = v1 + v2; if ((v1>0 && v2>0 && res<=0) …throw ArithmeticException..
=!N$-$=(?0,-!+<+-N7'0)>+90$ • 0D09&T(7$,(B0)*7G$>)(4$!"#$0D09&'0?$9(?0$*7'($!6=$0D09&'0?$9(?0$
=!N$-$N4E,0407'+T(7$
=!N$-$CD+4E,0$ public class JPF_java_lang_String { ! ... ! public static int indexOf__I__I (MJIEnv env, int objref, int c) { ! int vref = env.getReferenceField(objref, "value"); ! int off = env.getIntField(objref, "offset"); ! int len = env.getIntField(objref, "count"); ! for (int i=0, j=off; i<len; i++, j++){ ! if ((int)env.getCharArrayElement(vref, j) == c) ! return i; ! } ! return -1; ! } ! public static int toCharArray_____3C (MJIEnv env, int objref){ ! ... ! int cref = env.newCharArray(len); ! for (int i=0, j=off; i<len; i++, j++){ ! env.setCharArrayElement(cref, i, env.getCharArrayElement(vref, j)); ! } ! return cref; ! } ! public static boolean matches__Ljava_lang_String_2__Z (MJIEnv env,int objRef, int regexRef) { ! String s = env.getStringObject(objRef); ! String r = env.getStringObject(regexRef); ! return s.matches(r); ! } !
Recommend
More recommend