[Fb-contrib-commit] SF.net SVN: fb-contrib: [965] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2007-11-10 00:52:18
|
Revision: 965 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=965&view=rev Author: dbrosius Date: 2007-11-09 16:52:21 -0800 (Fri, 09 Nov 2007) Log Message: ----------- handle negative branches Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-10 00:37:31 UTC (rev 964) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-10 00:52:21 UTC (rev 965) @@ -124,18 +124,18 @@ if ((seen == IFEQ) || (seen == IFLE) || (seen == IFNE)) { if (lastLoadWasString && (lastPCs[0] != -1)) { byte[] bytes = getCode().getCode(); - int loadIns = get1Byte(bytes, lastPCs[2]); + int loadIns = getbyte(bytes, lastPCs[2]); int brOffset = (loadIns == ALOAD) ? 11 : 10; if ((((loadIns >= ALOAD_0) && (loadIns <= ALOAD_3)) || (loadIns == ALOAD)) - && (get1Byte(bytes, lastPCs[3]) == INVOKEVIRTUAL) - && (get1Byte(bytes, lastPCs[2]) == loadIns) - && (get1Byte(bytes, lastPCs[1]) == IFNULL) - && (get1Byte(bytes, lastPCs[0]) == loadIns) - && ((loadIns != ALOAD) || (get1Byte(bytes, lastPCs[2]+1) == get1Byte(bytes, lastPCs[0]+1))) - && ((seen == IFNE) ? get2Bytes(bytes, lastPCs[1]+1) > brOffset : get2Bytes(bytes, lastPCs[1]+1) == brOffset)) { + && (getbyte(bytes, lastPCs[3]) == INVOKEVIRTUAL) + && (getbyte(bytes, lastPCs[2]) == loadIns) + && (getbyte(bytes, lastPCs[1]) == IFNULL) + && (getbyte(bytes, lastPCs[0]) == loadIns) + && ((loadIns != ALOAD) || (getbyte(bytes, lastPCs[2]+1) == getbyte(bytes, lastPCs[0]+1))) + && ((seen == IFNE) ? getshort(bytes, lastPCs[1]+1) > brOffset : getshort(bytes, lastPCs[1]+1) == brOffset)) { ConstantPool pool = getConstantPool(); - int mpoolIndex = get2Bytes(bytes, lastPCs[3]+1); + int mpoolIndex = getshort(bytes, lastPCs[3]+1); ConstantMethodref cmr = (ConstantMethodref)pool.getConstant(mpoolIndex); int nandtIndex = cmr.getNameAndTypeIndex(); ConstantNameAndType cnt = (ConstantNameAndType)pool.getConstant(nandtIndex); @@ -406,13 +406,14 @@ } } - private int get1Byte(byte[] bytes, int offset) + private int getbyte(byte[] bytes, int offset) { return (0x00FF & bytes[offset]); } - private int get2Bytes(byte[] bytes, int offset) + private int getshort(byte[] bytes, int offset) { - return (0x0000FFFF & (bytes[offset] << 8)) | (0x00FF & bytes[offset+1]); + short s = (short)((0x0000FFFF & (bytes[offset] << 8)) | (0x00FF & bytes[offset+1])); + return s; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |