Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ReDoS #593

Merged
merged 1 commit into from Apr 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions index.js
Expand Up @@ -799,7 +799,7 @@ var QUERIES = [
select: sinceQuery
},
{
regexp: /^(>=?|<=?)\s*(\d*\.?\d+)%$/,
regexp: /^(>=?|<=?)\s*(d+|\d*\.\d+)%$/,
select: function (context, sign, popularity) {
popularity = parseFloat(popularity)
var usage = browserslist.usage.global
Expand All @@ -824,7 +824,7 @@ var QUERIES = [
}
},
{
regexp: /^(>=?|<=?)\s*(\d*\.?\d+)%\s+in\s+my\s+stats$/,
regexp: /^(>=?|<=?)\s*(d+|\d*\.\d+)%\s+in\s+my\s+stats$/,
select: function (context, sign, popularity) {
popularity = parseFloat(popularity)
if (!context.customUsage) {
Expand Down Expand Up @@ -852,7 +852,7 @@ var QUERIES = [
}
},
{
regexp: /^(>=?|<=?)\s*(\d*\.?\d+)%\s+in\s+(\S+)\s+stats$/,
regexp: /^(>=?|<=?)\s*(d+|\d*\.\d+)%\s+in\s+(\S+)\s+stats$/,
select: function (context, sign, popularity, name) {
popularity = parseFloat(popularity)
var stats = env.loadStat(context, name, browserslist.data)
Expand Down Expand Up @@ -887,7 +887,7 @@ var QUERIES = [
}
},
{
regexp: /^(>=?|<=?)\s*(\d*\.?\d+)%\s+in\s+((alt-)?\w\w)$/,
regexp: /^(>=?|<=?)\s*(d+|\d*\.\d+)%\s+in\s+((alt-)?\w\w)$/,
select: function (context, sign, popularity, place) {
popularity = parseFloat(popularity)
if (place.length === 2) {
Expand Down Expand Up @@ -918,11 +918,11 @@ var QUERIES = [
}
},
{
regexp: /^cover\s+(\d*\.?\d+)%$/,
regexp: /^cover\s+(d+|\d*\.\d+)%$/,
select: coverQuery
},
{
regexp: /^cover\s+(\d*\.?\d+)%\s+in\s+(my\s+stats|(alt-)?\w\w)$/,
regexp: /^cover\s+(d+|\d*\.\d+)%\s+in\s+(my\s+stats|(alt-)?\w\w)$/,
select: coverQuery
},
{
Expand Down