Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib:[1074] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-10-22 19:50:54
|
Revision: 1074
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1074&view=rev
Author: dbrosius
Date: 2008-10-22 19:50:46 +0000 (Wed, 22 Oct 2008)
Log Message:
-----------
guard against bad stack
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-10-05 03:19:29 UTC (rev 1073)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2008-10-22 19:50:46 UTC (rev 1074)
@@ -526,8 +526,7 @@
} finally {
stack.sawOpcode(this, seen);
- if (userValue != null)
- {
+ if ((userValue != null) && stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(userValue);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-01-18 07:11:37
|
Revision: 1078
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1078&view=rev
Author: dbrosius
Date: 2009-01-18 07:11:31 +0000 (Sun, 18 Jan 2009)
Log Message:
-----------
don't report classes that implement calendar, other than GregorianCalendar - as odd as that is
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 2009-01-02 02:10:49 UTC (rev 1077)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-01-18 07:11:31 UTC (rev 1078)
@@ -62,6 +62,15 @@
collectionInterfaces.add("java/util/SortedMap");
}
+ private static JavaClass calendarClass;
+ static {
+ try {
+ calendarClass = Repository.lookupClass("java/util.Calendar");
+ } catch (ClassNotFoundException cnfe) {
+ calendarClass = null;
+ }
+ }
+
private final BugReporter bugReporter;
private OpcodeStack stack;
private int lastPCs[];
@@ -434,10 +443,18 @@
String itemSig = item.getSignature();
//Rule out java.lang.Object as mergeJumps can throw away type info (BUG)
if (!"Ljava/lang/Object;".equals(itemSig) && !"Ljava/util/Calendar;".equals(itemSig) && !"Ljava/util/GregorianCalendar;".equals(itemSig)) {
- bugReporter.reportBug(new BugInstance(this, "SPP_INVALID_CALENDAR_COMPARE", NORMAL_PRIORITY)
- .addClass(this)
- .addMethod(this)
- .addSourceLine(this));
+ try {
+ JavaClass cls = Repository.lookupClass(itemSig.substring(1, itemSig.length() - 1));
+ if (!cls.implementationOf(calendarClass)) {
+ bugReporter.reportBug(new BugInstance(this, "SPP_INVALID_CALENDAR_COMPARE", NORMAL_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
+ } catch (ClassNotFoundException cnfe) {
+ bugReporter.reportMissingClass(cnfe);
+ }
+
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-01-18 07:20:59
|
Revision: 1079
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1079&view=rev
Author: dbrosius
Date: 2009-01-18 07:20:48 +0000 (Sun, 18 Jan 2009)
Log Message:
-----------
oops use slashes
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 2009-01-18 07:11:31 UTC (rev 1078)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-01-18 07:20:48 UTC (rev 1079)
@@ -65,7 +65,7 @@
private static JavaClass calendarClass;
static {
try {
- calendarClass = Repository.lookupClass("java/util.Calendar");
+ calendarClass = Repository.lookupClass("java/util/Calendar");
} catch (ClassNotFoundException cnfe) {
calendarClass = null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-01-18 07:25:42
|
Revision: 1080
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1080&view=rev
Author: dbrosius
Date: 2009-01-18 07:25:34 +0000 (Sun, 18 Jan 2009)
Log Message:
-----------
Calendar is a class, use instanceOf
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 2009-01-18 07:20:48 UTC (rev 1079)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-01-18 07:25:34 UTC (rev 1080)
@@ -445,7 +445,7 @@
if (!"Ljava/lang/Object;".equals(itemSig) && !"Ljava/util/Calendar;".equals(itemSig) && !"Ljava/util/GregorianCalendar;".equals(itemSig)) {
try {
JavaClass cls = Repository.lookupClass(itemSig.substring(1, itemSig.length() - 1));
- if (!cls.implementationOf(calendarClass)) {
+ if (!cls.instanceOf(calendarClass)) {
bugReporter.reportBug(new BugInstance(this, "SPP_INVALID_CALENDAR_COMPARE", NORMAL_PRIORITY)
.addClass(this)
.addMethod(this)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2009-04-25 05:20:07
|
Revision: 1184
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1184&view=rev
Author: dbrosius
Date: 2009-04-25 05:19:58 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
add check for .size() <= 0
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 2009-04-25 05:19:45 UTC (rev 1183)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-04-25 05:19:58 UTC (rev 1184)
@@ -186,7 +186,7 @@
}
}
- if ((seen == IFEQ) || (seen == IFNE)) {
+ if ((seen == IFEQ) || (seen == IFNE) || (seen == IFGT)) {
if (stack.getStackDepth() == 1) {
OpcodeStack.Item item = stack.getStackItem(0);
if ("size".equals(item.getUserValue())) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2010-01-11 03:38:28
|
Revision: 1466
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1466&view=rev
Author: dbrosius
Date: 2010-01-11 03:38:21 +0000 (Mon, 11 Jan 2010)
Log Message:
-----------
remove deprecations
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-01-10 17:58:57 UTC (rev 1465)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2010-01-11 03:38:21 UTC (rev 1466)
@@ -227,7 +227,7 @@
} else if (seen == IFEQ) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
- lastIfEqWasBoolean = "Z".equals(itm.getElementSignature());
+ lastIfEqWasBoolean = "Z".equals(itm.getSignature());
}
byte[] bytes = getCode().getCode();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <dbr...@us...> - 2011-05-05 01:00:44
|
Revision: 1665
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1665&view=rev
Author: dbrosius
Date: 2011-05-05 01:00:38 +0000 (Thu, 05 May 2011)
Log Message:
-----------
fix some SPP temporary trim() false positives
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 2011-04-30 19:46:27 UTC (rev 1664)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2011-05-05 01:00:38 UTC (rev 1665)
@@ -345,6 +345,12 @@
.addSourceLine(this));
}
}
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ if ("trim".equals(item.getUserValue())) {
+ item.setUserValue(null);
+ }
+ }
} else if (((seen >= ALOAD_0) && (seen <= ASTORE_3)) || (seen == ALOAD)) {
lastLoadWasString = false;
LocalVariableTable lvt = getMethod().getLocalVariableTable();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2011-06-04 04:45:00
|
Revision: 1668
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1668&view=rev
Author: dbrosius
Date: 2011-06-04 04:44:54 +0000 (Sat, 04 Jun 2011)
Log Message:
-----------
SillynessPotPourri throws ClassCastException - ID: 3309447
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 2011-06-04 00:12:55 UTC (rev 1667)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2011-06-04 04:44:54 UTC (rev 1668)
@@ -140,9 +140,7 @@
public void sawOpcode(int seen) {
int reg = -1;
String userValue = null;
- try {
- stack.mergeJumps(this);
-
+ try {
if (((seen >= IFEQ) && (seen <= GOTO)) || (seen == IFNULL) || (seen == IFNONNULL) || (seen == GOTO_W)) {
Integer branchTarget = Integer.valueOf(getBranchTarget());
Set<Integer> branchInsSet = branchTargets.get(branchTarget);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|