File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
test/query-tests/security/CWE-367/semmle/tests Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,9 @@ predicate alwaysLocked(Field f) {
6868 or
6969 exists ( RefType thisType |
7070 forex ( VarAccess access |
71- access = f .getAnAccess ( ) and not access .getEnclosingCallable ( ) instanceof InitializerMethod
71+ access = f .getAnAccess ( ) and
72+ not access .getEnclosingCallable ( ) instanceof Constructor and
73+ not access .getEnclosingCallable ( ) instanceof InitializerMethod
7274 |
7375 locallySynchronizedOnThis ( access , thisType )
7476 )
Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ public FieldAlwaysLocked() {
1414 protected synchronized void checkOut () {
1515 Object o ;
1616 if (field .size () > 0 ) {
17- Enumeration e = field .keys (); // $ SPURIOUS: Alert
17+ Enumeration e = field .keys ();
1818 while (e .hasMoreElements ()) {
1919 o = e .nextElement ();
20- field .remove (o ); // $ SPURIOUS: Alert
20+ field .remove (o );
2121 }
2222 }
2323 }
You can’t perform that action at this time.
0 commit comments