don't decode images that are too large
This commit is contained in:
parent
29334c3116
commit
1c6bb1fef4
|
@ -138,7 +138,8 @@ func savedonk(url string, name, media string, localize bool) *Donk {
|
||||||
|
|
||||||
data = buf.Bytes()
|
data = buf.Bytes()
|
||||||
if strings.HasPrefix(media, "image") {
|
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 {
|
if err != nil {
|
||||||
log.Printf("unable to decode image: %s", err)
|
log.Printf("unable to decode image: %s", err)
|
||||||
localize = false
|
localize = false
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
changelog
|
changelog
|
||||||
|
|
||||||
|
-- next
|
||||||
|
|
||||||
|
+ Don't decode excessively large images and run out of memory.
|
||||||
|
|
||||||
-- 0.7.7
|
-- 0.7.7
|
||||||
|
|
||||||
+ Add another retry to workaround pixelfed's general unreliability.
|
+ Add another retry to workaround pixelfed's general unreliability.
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -7,5 +7,5 @@ require (
|
||||||
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
|
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
|
||||||
humungus.tedunangst.com/r/go-sqlite3 v1.1.3
|
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
|
||||||
)
|
)
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -23,3 +23,5 @@ humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9
|
||||||
humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M=
|
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 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.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=
|
||||||
|
|
Loading…
Reference in New Issue