Ran infer

This commit is contained in:
Claudio Maggioni 2023-04-11 10:16:05 +02:00
parent 3fcefd6e59
commit e320c10a38
14 changed files with 167 additions and 0 deletions

8
before/.gitignore vendored
View file

@ -18,3 +18,11 @@ site-content
.project .project
.externalToolBuilders .externalToolBuilders
.checkstyle .checkstyle
# Maven repository cache for docker container
.m2/
# infer tmp folder
infer-out/tmp/
infer-out/bugs.txt
infer-out/logs

14
before/docker-infer.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
mkdir -pv "${SCRIPT_DIR}/.m2"
# Cache .m2 directory in local bind mount
# I am on an ICE right now. German Wi-Fi is the wurst
docker run --rm -it \
-v "${SCRIPT_DIR}:/tools/home" \
-v "${SCRIPT_DIR}/.m2:/root/.m2" \
bugcounting/satools:y23 \
/tools/home/entrypoint.sh

13
before/docker-start.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
mkdir -pv "${SCRIPT_DIR}/.m2"
# Cache .m2 directory in local bind mount
# I am on an ICE right now. German Wi-Fi is the wurst
docker run --rm -it \
-v "${SCRIPT_DIR}:/tools/home" \
-v "${SCRIPT_DIR}/.m2:/root/.m2" \
bugcounting/satools:y23

6
before/entrypoint.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
set -e
cd /tools/home
/tools/infer/bin/infer -- mvn compile -Drat.skip=true

Binary file not shown.

View file

@ -0,0 +1 @@
{"run_sequence":[{"date":"2023-04-11 09:38:59.468025+02:00","command":"run","infer_version":{"major":1,"minor":1,"patch":0,"commit":"f9b6f2b"}}],"results_dir_format":"db_filename: infer-out/results.db\ndb_schema: \n CREATE TABLE IF NOT EXISTS procedures\n ( proc_uid TEXT PRIMARY KEY NOT NULL\n , proc_name BLOB NOT NULL\n , attr_kind INTEGER NOT NULL\n , source_file TEXT NOT NULL\n , proc_attributes BLOB NOT NULL\n , cfg BLOB\n , callees BLOB NOT NULL\n )\n ;\n\n CREATE TABLE IF NOT EXISTS source_files\n ( source_file TEXT PRIMARY KEY\n , type_environment BLOB NOT NULL\n , integer_type_widths BLOB\n , procedure_names BLOB NOT NULL\n , freshly_captured INT NOT NULL )\n ;\n\n CREATE TABLE IF NOT EXISTS specs\n ( proc_uid TEXT PRIMARY KEY NOT NULL\n , proc_name BLOB NOT NULL\n , analysis_summary BLOB NOT NULL\n , report_summary BLOB NOT NULL\n )\n ;\n\n CREATE TABLE IF NOT EXISTS model_specs\n ( proc_uid TEXT PRIMARY KEY NOT NULL\n , proc_name BLOB NOT NULL\n , analysis_summary BLOB NOT NULL\n , report_summary BLOB NOT NULL\n )\n ","should_merge_capture":false}

View file

@ -0,0 +1 @@
[]

View file

@ -0,0 +1 @@
[]

File diff suppressed because one or more lines are too long

122
before/infer-out/report.txt Normal file
View file

@ -0,0 +1,122 @@
#0
src/main/java/org/apache/commons/lang3/AnnotationUtils.java:72: error: Null Dereference
object returned by `getAllInterfaces(cls)` could be null and is dereferenced at line 72.
70. @Override
71. protected String getShortClassName(final Class<?> cls) {
72. > for (final Class<?> iface : ClassUtils.getAllInterfaces(cls)) {
73. if (Annotation.class.isAssignableFrom(iface)) {
74. return "@" + iface.getName();
#1
src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java:126: error: Null Dereference
object returned by `getAllInterfaces(cls)` could be null and is dereferenced at line 126.
124. // superclass field.
125. Field match = null;
126. > for (final Class<?> class1 : ClassUtils.getAllInterfaces(cls)) {
127. try {
128. final Field test = class1.getField(fieldName);
#2
src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java:131: error: Null Dereference
object `null` is dereferenced by call to `toString(...)` at line 131.
129. */
130. public static String toString(final Object object) {
131. > return toString(object, null, false, false, null);
132. }
133.
#3
src/main/java/org/apache/commons/lang3/time/DurationUtils.java:142: error: Null Dereference
object returned by `org.apache.commons.lang3.time.DurationUtils.LONG_TO_INT_RANGE.fit(valueOf(duration.toMillis()))` could be null and is dereferenced at line 142.
140. Objects.requireNonNull(duration, "duration");
141. // intValue() does not do a narrowing conversion here
142. > return LONG_TO_INT_RANGE.fit(Long.valueOf(duration.toMillis())).intValue();
143. }
144.
#4
src/main/java/org/apache/commons/lang3/CharSetUtils.java:181: error: Null Dereference
object `chars` last assigned on line 177 could be null and is dereferenced at line 181.
179. final char[] chrs = str.toCharArray();
180. for (final char chr : chrs) {
181. > if (chars.contains(chr) == expect) {
182. buffer.append(chr);
183. }
#5
src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java:223: error: Null Dereference
object `null` is dereferenced by call to `ToStringBuilder(...)` at line 223.
221. */
222. public ToStringBuilder(final Object object) {
223. > this(object, null, null);
224. }
225.
#6
src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java:341: error: Null Dereference
object `field` last assigned on line 338 could be null and is dereferenced by call to `readStaticField(...)` at line 341.
339. Validate.notNull(field, "Cannot locate field '%s' on %s", fieldName, cls);
340. // already forced access above, don't repeat it here:
341. > return readStaticField(field, false);
342. }
343.
#7
src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java:385: error: Null Dereference
object `field` last assigned on line 382 could be null and is dereferenced by call to `readStaticField(...)` at line 385.
383. Validate.notNull(field, "Cannot locate declared field %s.%s", cls.getName(), fieldName);
384. // already forced access above, don't repeat it here:
385. > return readStaticField(field, false);
386. }
387.
#8
src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java:486: error: Null Dereference
object returned by `primitiveToWrapper(varArgComponentType)` could be null and is dereferenced by call to `newInstance(...)` at line 486.
484. final int varArgLength = args.length - methodParameterTypes.length + 1;
485.
486. > Object varArgsArray = Array.newInstance(ClassUtils.primitiveToWrapper(varArgComponentType), varArgLength);
487. // Copy the variadic arguments into the varargs array.
488. System.arraycopy(args, methodParameterTypes.length - 1, varArgsArray, 0, varArgLength);
#9
src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java:599: error: Null Dereference
object `field` last assigned on line 596 could be null and is dereferenced by call to `writeStaticField(...)` at line 599.
597. Validate.notNull(field, "Cannot locate field %s on %s", fieldName, cls);
598. // already forced access above, don't repeat it here:
599. > writeStaticField(field, value, false);
600. }
601.
#10
src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java:644: error: Null Dereference
object `field` last assigned on line 641 could be null and is dereferenced by call to `writeField(...)` at line 644.
642. Validate.notNull(field, "Cannot locate declared field %s.%s", cls.getName(), fieldName);
643. // already forced access above, don't repeat it here:
644. > writeField(field, (Object) null, value, false);
645. }
646.
#11
src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java:987: error: Null Dereference
object `classes` last assigned on line 986 could be null and is dereferenced at line 987.
985. final Class<?> mcls = method.getDeclaringClass();
986. final List<Class<?>> classes = getAllSuperclassesAndInterfaces(mcls);
987. > for (final Class<?> acls : classes) {
988. final Method equivalentMethod = (ignoreAccess ? MethodUtils.getMatchingMethod(acls, method.getName(), method.getParameterTypes())
989. : MethodUtils.getMatchingAccessibleMethod(acls, method.getName(), method.getParameterTypes()));
#12
src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java:160: warning: Thread Safety Violation
Read/Write race. Non-private method `MultiBackgroundInitializer.getTaskCount()` reads without synchronization from container `this.childInitializers` via call to `Map.values()`. Potentially races with write in method `MultiBackgroundInitializer.addInitializer(...)`.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
158. int result = 1;
159.
160. > for (final BackgroundInitializer<?> bi : childInitializers.values()) {
161. result += bi.getTaskCount();
162. }
Found 13 issues
Issue Type(ISSUED_TYPE_ID): #
Null Dereference(NULL_DEREFERENCE): 12
Thread Safety Violation(THREAD_SAFETY_VIOLATION): 1

BIN
before/infer-out/results.db Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.