Skip to content

Commit

Permalink
Wrap TaintSpew in compiler flag
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbrbr committed Dec 3, 2024
1 parent b51843e commit eda203a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/src/jstaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,19 @@ void JS::MarkTaintedFunctionArguments(JSContext* cx, JSFunction* function, const
}

void JS::MaybeSpewStringTaint(JSContext* cx, JSString* str) {
//#ifdef JS_STRUCTURED_SPEW
#ifdef JS_STRUCTURED_SPEW
if (!str || !str->taint()) {
return;
}

AutoStructuredSpewer spew(cx, SpewChannel::TaintFlowSpewer, cx->currentScript());
if (spew) {
spew->property("str", str);
JSLinearString* linear = str->ensureLinear(cx);
if (linear) {
spew->property("str", linear);
} else {
spew->property("str", "Non-linear String!");
}

spew->beginListProperty("taint");
for (const TaintRange& range : str->taint()) {
Expand Down Expand Up @@ -419,7 +424,7 @@ void JS::MaybeSpewStringTaint(JSContext* cx, JSString* str) {
spew->endList();

}
//#endif
#endif
}

// Print a message to stdout.
Expand Down

0 comments on commit eda203a

Please sign in to comment.