From 2e1b0c1546e0173c0907cf05c67b8ba29ed8b4d1 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Sat, 3 Oct 2020 21:20:15 +0900 Subject: [PATCH] Avoid index out of range --- colorable_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colorable_windows.go b/colorable_windows.go index 04c4229..41215d7 100644 --- a/colorable_windows.go +++ b/colorable_windows.go @@ -719,7 +719,7 @@ loop: n256setup() } attr &= backgroundMask - attr |= n256foreAttr[n256] + attr |= n256foreAttr[n256%len(n256foreAttr)] i += 2 } } else if len(token) == 5 && token[i+1] == "2" { @@ -761,7 +761,7 @@ loop: n256setup() } attr &= foregroundMask - attr |= n256backAttr[n256] + attr |= n256backAttr[n256%len(n256backAttr)] i += 2 } } else if len(token) == 5 && token[i+1] == "2" {