mirror of
https://github.com/mattermost/mattermost.git
synced 2026-08-27 05:37:15 -05:00
Explicitly cast to an int64 when selecting a random profile picture colour to prevent overflow on 32-bit installations of Go
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user