]> Cypherpunks repositories - gostls13.git/commit
image/gif: revert incorrect usage of clear
authorRoland Shoemaker <roland@golang.org>
Tue, 9 Apr 2024 13:27:30 +0000 (15:27 +0200)
committerGopher Robot <gobot@golang.org>
Thu, 11 Apr 2024 16:15:54 +0000 (16:15 +0000)
commit48e00ab70a49652d4b015ac71b80da9f3ae7d1ab
tree0817dafdef6255ea682b7ae40335dc89de5cdc54
parentb6778c5230d554c1ba1a69b104513021467d32b2
image/gif: revert incorrect usage of clear

CL 570555 replaced a loop which added empty
color.RGBA elements with a call to clear.

color.Palette is a slice of interfaces, so using
clear results in a slice of nil elements, rather
than what we previously had which was empty
color.RGBA elements. This could cause a panic when
attempting to re-encode a GIF which had an
extended color palette because of the weird
transparency hack.

This was discovered by OSS-Fuzz. I've added a test
case using their reproducer in order to prevent
future regressions.

Change-Id: I00a89257d90b6cca68672173eecdaa0a24f18d9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/577555
Reviewed-by: Nigel Tao <nigeltao@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/image/gif/reader.go
src/image/gif/reader_test.go