Skip to content

Commit

Permalink
Merge pull request #542 from lostsnow/feature/add-range-command-overw…
Browse files Browse the repository at this point in the history
…rite

add taint range command OVERWRITE
  • Loading branch information
lostsnow authored Jul 6, 2023
2 parents a15a32a + e987bfe commit 1ec0fb6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum TaintCommand {
REMOVE,
REPLACE,
CONCAT,
OVERWRITE,
TRIM,
TRIM_RIGHT,
TRIM_LEFT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public TaintRanges run(PropagatorNode propagatorNode, Object source, Object targ
case CONCAT:
this.builder.concat(tr, target, oldTaintRanges, source, srcTaintRanges, params);
break;
case OVERWRITE:
this.builder.overwrite(tr, oldTaintRanges, source, srcTaintRanges, p1, this.paramsCount);
case TRIM:
case TRIM_LEFT:
case TRIM_RIGHT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ public void concat(TaintRanges taintRanges, Object target, TaintRanges oldTaintR
taintRanges.merge();
}

public void overwrite(TaintRanges taintRanges, TaintRanges oldTagRanges, Object source, TaintRanges srcTagRanges, int p1, int argC) {
if (argC == 1) {
int length = getLength(source);
srcTagRanges.shift(p1);
oldTagRanges.clear(p1, length + p1);
taintRanges.addAll(oldTagRanges);
taintRanges.addAll(srcTagRanges);
}
}

public void trim(TaintCommand command, TaintRanges taintRanges, Object source, TaintRanges srcTaintRanges, int argC) {
if (argC > 0) {
return;
Expand Down

0 comments on commit 1ec0fb6

Please sign in to comment.