don't decode images that are too large
Ted Unangst tedu@tedunangst.com
Wed, 07 Aug 2019 12:01:57 -0400
4 files changed,
9 insertions(+),
2 deletions(-)
M
activity.go
→
activity.go
@@ -138,7 +138,8 @@ io.Copy(&buf, resp.Body)
data = buf.Bytes() if strings.HasPrefix(media, "image") { - img, err := image.Vacuum(&buf, image.Params{MaxWidth: 2048, MaxHeight: 2048}) + img, err := image.Vacuum(&buf, + image.Params{LimitSize: 4800 * 4800, MaxWidth: 2048, MaxHeight: 2048}) if err != nil { log.Printf("unable to decode image: %s", err) localize = false
M
docs/changelog.txt
→
docs/changelog.txt
@@ -1,5 +1,9 @@
changelog +-- next + ++ Don't decode excessively large images and run out of memory. + -- 0.7.7 + Add another retry to workaround pixelfed's general unreliability.
M
go.mod
→
go.mod
@@ -7,5 +7,5 @@ github.com/mattn/go-runewidth v0.0.4
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 golang.org/x/net v0.0.0-20190620200207-3b0461eec859 humungus.tedunangst.com/r/go-sqlite3 v1.1.3 - humungus.tedunangst.com/r/webs v0.6.2 + humungus.tedunangst.com/r/webs v0.6.3 )
M
go.sum
→
go.sum
@@ -23,3 +23,5 @@ humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9ga8k38geUI=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M= humungus.tedunangst.com/r/webs v0.6.2 h1:qnlWTYqhp4d+YKlEEX6bQyyyIf+3ZVw/7YiIAGxHupE= humungus.tedunangst.com/r/webs v0.6.2/go.mod h1:Ho+nmafD/aUWF7LnH+Yl2/b0ob7f2pCkXm4onteWvLE= +humungus.tedunangst.com/r/webs v0.6.3 h1:WoN32ETiAgSfOSonxj47cZmspdbmdTNbwlvVDmEDR+I= +humungus.tedunangst.com/r/webs v0.6.3/go.mod h1:Ho+nmafD/aUWF7LnH+Yl2/b0ob7f2pCkXm4onteWvLE=