From 122a67c3b45548bd0d091a398c8d7c2a884681e6 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Mon, 6 Jul 2015 18:08:52 -0400 Subject: Explicitly cast to an int64 when selecting a random profile picture colour to prevent overflow on 32-bit installations of Go --- api/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api') diff --git a/api/user.go b/api/user.go index 292d2b61b..ada781bc7 100644 --- a/api/user.go +++ b/api/user.go @@ -593,7 +593,7 @@ func createProfileImage(username string, userId string) ([]byte, *model.AppError h.Write([]byte(userId)) seed := h.Sum32() - color := colors[int(seed)%len(colors)] + color := colors[int64(seed)%int64(len(colors))] img := image.NewRGBA(image.Rect(0, 0, int(utils.Cfg.ImageSettings.ProfileWidth), int(utils.Cfg.ImageSettings.ProfileHeight))) draw.Draw(img, img.Bounds(), &image.Uniform{color}, image.ZP, draw.Src) -- cgit v1.2.3-1-g7c22