Skip to content

Commit b5268de

Browse files
committed
Add models for CONST_BYTE and CONST_SHORT
1 parent 1c1ca70 commit b5268de

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

java/ql/src/semmle/code/java/frameworks/apache/Lang.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ private class ApacheObjectUtilsModel extends SummaryModelCsv {
409409
"org.apache.commons.lang3;ObjectUtils;false;clone;;;Argument;ReturnValue;value",
410410
"org.apache.commons.lang3;ObjectUtils;false;cloneIfPossible;;;Argument;ReturnValue;value",
411411
"org.apache.commons.lang3;ObjectUtils;false;CONST;;;Argument;ReturnValue;value",
412+
"org.apache.commons.lang3;ObjectUtils;false;CONST_BYTE;;;Argument;ReturnValue;value",
413+
"org.apache.commons.lang3;ObjectUtils;false;CONST_SHORT;;;Argument;ReturnValue;value",
412414
"org.apache.commons.lang3;ObjectUtils;false;defaultIfNull;;;Argument;ReturnValue;value",
413415
"org.apache.commons.lang3;ObjectUtils;false;firstNonNull;;;Argument;ReturnValue;taint",
414416
"org.apache.commons.lang3;ObjectUtils;false;getIfNull;;;Argument[0];ReturnValue;value",

java/ql/test/library-tests/frameworks/apache-commons-lang3/ObjectUtilsTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
public class ObjectUtilsTest {
44
String taint() { return "tainted"; }
55

6+
private static class IntSource {
7+
static int taint() { return 0; }
8+
}
9+
610
void sink(Object o) {}
711

812
void test() throws Exception {
913
sink(ObjectUtils.clone(taint())); // $hasTaintFlow=y $hasValueFlow=y
1014
sink(ObjectUtils.cloneIfPossible(taint())); // $hasTaintFlow=y $hasValueFlow=y
1115
sink(ObjectUtils.CONST(taint())); // $hasTaintFlow=y $hasValueFlow=y
16+
sink(ObjectUtils.CONST_SHORT(IntSource.taint())); // $hasTaintFlow=y $hasValueFlow=y
17+
sink(ObjectUtils.CONST_BYTE(IntSource.taint())); // $hasTaintFlow=y $hasValueFlow=y
1218
sink(ObjectUtils.defaultIfNull(taint(), null)); // $hasTaintFlow=y $hasValueFlow=y
1319
sink(ObjectUtils.defaultIfNull(null, taint())); // $hasTaintFlow=y $hasValueFlow=y
1420
sink(ObjectUtils.firstNonNull(taint(), null, null)); // $hasTaintFlow=y $MISSING:hasValueFlow=y

0 commit comments

Comments
 (0)