summaryrefslogtreecommitdiffstats
path: root/api/user.go
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-07-06 18:08:52 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-07-06 18:08:52 -0400
commit122a67c3b45548bd0d091a398c8d7c2a884681e6 (patch)
tree5678790d7a61c38e5e68f7510625404acb2069c1 /api/user.go
parent3dec509899f60ca0d2eadfcc192ccc49969852ef (diff)
downloadchat-122a67c3b45548bd0d091a398c8d7c2a884681e6.tar.gz
chat-122a67c3b45548bd0d091a398c8d7c2a884681e6.tar.bz2
chat-122a67c3b45548bd0d091a398c8d7c2a884681e6.zip
Explicitly cast to an int64 when selecting a random profile picture colour to prevent overflow on 32-bit installations of Go
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go2
1 files changed, 1 insertions, 1 deletions
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)