Merge pull request #279 from yetingli/master

Fix ReDos in CSS_RGB and CSS_RGBA
This commit is contained in:
Mr.doob 2021-05-12 14:41:57 +01:00 committed by GitHub
commit f720c729de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ const INTERPRETATIONS = [
CSS_RGB: { CSS_RGB: {
read: function(original) { 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) { if (test === null) {
return false; return false;
} }
@ -76,7 +76,7 @@ const INTERPRETATIONS = [
CSS_RGBA: { CSS_RGBA: {
read: function(original) { 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) { if (test === null) {
return false; return false;
} }