From a86ab4f52581dd2ff83d82d70b61785d889536db Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 6 Dec 2022 21:26:05 +0100 Subject: [PATCH] fix(color): validate number range --- src/color/colors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/color/colors.go b/src/color/colors.go index b410eda7..3c4d82bb 100644 --- a/src/color/colors.go +++ b/src/color/colors.go @@ -81,7 +81,7 @@ func (d *DefaultColors) AnsiColorFromString(colorString string, isBackground boo } if !strings.HasPrefix(colorString, "#") { val, err := strconv.ParseUint(colorString, 10, 64) - if err != nil { + if err != nil || val > 255 { return emptyAnsiColor } c256 := color.C256(uint8(val), isBackground)