mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 03:51:40 +01:00
Limit colour strings to 200 chars, helps reduce effect of potential ReDoS
This commit is contained in:
parent
c1c16ed3e6
commit
206eb4a89a
@ -139,7 +139,10 @@ function toColorspace (colorspace) {
|
|||||||
* @throws {Error} Invalid value
|
* @throws {Error} Invalid value
|
||||||
*/
|
*/
|
||||||
function _getBackgroundColourOption (value) {
|
function _getBackgroundColourOption (value) {
|
||||||
if (is.object(value) || is.string(value)) {
|
if (
|
||||||
|
is.object(value) ||
|
||||||
|
(is.string(value) && value.length >= 3 && value.length <= 200)
|
||||||
|
) {
|
||||||
const colour = color(value);
|
const colour = color(value);
|
||||||
return [
|
return [
|
||||||
colour.red(),
|
colour.red(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user