chore: try to fix CodeQL failure "Polynomial regular expression"
Fix 1: \d\.?\d* can backtrack catastrophically \d(\.\d*)? is safer Fix 2: Useless parenthesis around "enc:" Fix 3: The httpTester regex was misleading. It did not really check for "http". Simplified to show its true meaning. The behaviour should not have changed. Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
This commit is contained in:
parent
0d6cf4907c
commit
0c59e28c43
1 changed files with 2 additions and 2 deletions
|
|
@ -22,8 +22,8 @@ import { getFontsPbf, getTileUrls, fixTileJSONCenter } from './utils.js';
|
|||
|
||||
const FLOAT_PATTERN = '[+-]?(?:\\d+|\\d+.?\\d+)';
|
||||
const PATH_PATTERN =
|
||||
/^((fill|stroke|width)\:[^\|]+\|)*((enc:.+)|((-?\d+\.?\d*,-?\d+\.?\d*\|)+(-?\d+\.?\d*,-?\d+\.?\d*)))/;
|
||||
const httpTester = /^(http(s)?:)?\/\//;
|
||||
/^((fill|stroke|width)\:[^\|]+\|)*(enc:.+|(-?\d+(\.\d*)?,-?\d+(\.\d*)?\|)+(-?\d+(\.\d*)?,-?\d+(\.\d*)?)*)/;
|
||||
const httpTester = /^\/\//;
|
||||
|
||||
const mercator = new SphericalMercator();
|
||||
const getScale = (scale) => (scale || '@1x').slice(1, 2) | 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue