mirror of
https://github.com/github/codeql.git
synced 2025-12-21 11:16:30 +01:00
dont extract regular expressions from strings that are leaves in a string concat
This commit is contained in:
@@ -596,7 +596,7 @@ public class ASTExtractor {
|
||||
offsets.set(0, 1); // skip the initial '/'
|
||||
SourceMap sourceMap = SourceMap.legacyWithStartPos(SourceMap.fromString(nd.getRaw()).offsetBy(0, offsets), startPos);
|
||||
regexpExtractor.extract(source.substring(1, source.lastIndexOf('/')), sourceMap, nd, false);
|
||||
} else if (nd.isStringLiteral() && !c.isInsideType() && nd.getRaw().length() < 1000) {
|
||||
} else if (nd.isStringLiteral() && !c.isInsideType() && nd.getRaw().length() < 1000 && !c.isBinopOperand()) {
|
||||
SourceMap sourceMap = SourceMap.legacyWithStartPos(SourceMap.fromString(nd.getRaw()).offsetBy(0, makeStringLiteralOffsets(nd.getRaw())), startPos);
|
||||
regexpExtractor.extract(valueString, sourceMap, nd, true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user