Merge pull request #141 from hmhealey/profilepicture32bit

Fix an out of bounds exception when generating profile pictures on 32 bit installations
This commit is contained in:
Christopher Speller
2015-07-07 08:44:29 -04:00

View File

@@ -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)