Fix ReDos in CSS_RGB and CSS_RGBA

This commit is contained in:
yeting li 2020-10-06 22:40:57 +08:00 committed by GitHub
parent 51d1a37b00
commit 1e1aecb579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ const INTERPRETATIONS = [
CSS_RGB: {
read: function(original) {
const test = original.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
const test = original.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);
if (test === null) {
return false;
}
@ -76,7 +76,7 @@ const INTERPRETATIONS = [
CSS_RGBA: {
read: function(original) {
const test = original.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
const test = original.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);
if (test === null) {
return false;
}