Skip to content

Commit 13115b6

Browse files
committed
Fix tests + make a static variable to avoid multiple instances
1 parent 6789d60 commit 13115b6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

dd-java-agent/agent-iast/src/main/java/com/datadog/iast/model/VulnerabilityType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ public String getName() {
273273
}
274274

275275
class Builder {
276+
private static final BitSet BIT_SET = new BitSet(SourceTypes.STRINGS.length + 1);
277+
276278
private final byte type;
277279
private char separator = ' ';
278280
private int mark = NOT_MARKED;
@@ -301,7 +303,7 @@ public Builder deduplicable(final boolean deduplicable) {
301303
}
302304

303305
public Builder excludedSources(final byte... excludedSources) {
304-
BitSet bitSet = new BitSet(SourceTypes.STRINGS.length + 1);
306+
BitSet bitSet = BIT_SET;
305307
for (byte value : excludedSources) {
306308
bitSet.set(value);
307309
}

dd-java-agent/agent-iast/src/main/java/com/datadog/iast/taint/Ranges.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ public static Range[] excludeRangesBySource(Range[] ranges, BitSet source) {
438438
RangeBuilder newRanges = new RangeBuilder(ranges.length);
439439

440440
for (Range range : ranges) {
441-
if (!source.get(range.getSource().getOrigin())) {
441+
if (range.getSource().getOrigin() == SourceTypes.NONE
442+
|| !source.get(range.getSource().getOrigin())) {
442443
newRanges.add(range);
443444
}
444445
}

0 commit comments

Comments
 (0)