[Fb-contrib-commit] SF.net SVN: fb-contrib:[1543] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-04-04 16:34:48
|
Revision: 1543
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1543&view=rev
Author: dbrosius
Date: 2010-04-04 16:34:42 +0000 (Sun, 04 Apr 2010)
Log Message:
-----------
add check for calling java.lang.reflect.Array methods on non arrays
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 2010-04-04 16:34:08 UTC (rev 1542)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2010-04-04 16:34:42 UTC (rev 1543)
@@ -399,6 +399,28 @@
}
}
}
+ } else if ("java/lang/reflect/Array".equals(className)) {
+ int offset = -1;
+ if ("getLength".equals(methodName)) {
+ offset = 0;
+ } else if (methodName.startsWith("get")) {
+ offset = 1;
+ } else if (methodName.startsWith("set")) {
+ offset = 2;
+ }
+ if (offset >= 0) {
+ if (stack.getStackDepth() > offset) {
+ OpcodeStack.Item item = stack.getStackItem(offset);
+ String sig = item.getSignature();
+ if ((sig.charAt(0) != '[') && !"Ljava/lang/Object;".equals(sig)) {
+ bugReporter.reportBug(new BugInstance(this, "SPP_NON_ARRAY_PARM", HIGH_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
+ }
+ }
+
}
} else if (seen == INVOKEVIRTUAL) {
String className = getClassConstantOperand();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|