[Fb-contrib-commit] SF.net SVN: fb-contrib: [1021] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-05-26 23:01:28
|
Revision: 1021 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1021&view=rev Author: dbrosius Date: 2008-05-26 16:01:37 -0700 (Mon, 26 May 2008) Log Message: ----------- guard against a null and length() == 0 having a body of continue. ie. don't report 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 2008-05-21 10:45:22 UTC (rev 1020) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2008-05-26 23:01:37 UTC (rev 1021) @@ -136,16 +136,19 @@ && (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 = getshort(bytes, lastPCs[3]+1); - ConstantMethodref cmr = (ConstantMethodref)pool.getConstant(mpoolIndex); - int nandtIndex = cmr.getNameAndTypeIndex(); - ConstantNameAndType cnt = (ConstantNameAndType)pool.getConstant(nandtIndex); - if ("length".equals(cnt.getName(pool))) { - bugReporter.reportBug(new BugInstance(this, "SPP_SUSPECT_STRING_TEST", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + int nextOp = getbyte(bytes, getNextPC()); + if ((nextOp != GOTO) && (nextOp != GOTO_W)) { + ConstantPool pool = getConstantPool(); + int mpoolIndex = getshort(bytes, lastPCs[3]+1); + ConstantMethodref cmr = (ConstantMethodref)pool.getConstant(mpoolIndex); + int nandtIndex = cmr.getNameAndTypeIndex(); + ConstantNameAndType cnt = (ConstantNameAndType)pool.getConstant(nandtIndex); + if ("length".equals(cnt.getName(pool))) { + bugReporter.reportBug(new BugInstance(this, "SPP_SUSPECT_STRING_TEST", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |