From 1c2c01722b1c40b5563b065e221c3882a319c37b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 15 Oct 2025 08:29:23 +0530 Subject: [PATCH] Bump version of imaging Fixes an out of bounds error when processing opaque images --- go.mod | 2 +- go.sum | 8 ++++---- tools/utils/images/to_rgba.go | 7 +++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 9de960321..bd98fca38 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/kovidgoyal/dbus v0.0.0-20250519011319-e811c41c0bc1 github.com/kovidgoyal/exiffix v0.0.0-20250919160812-dbef770c2032 github.com/kovidgoyal/go-parallel v1.0.1 - github.com/kovidgoyal/imaging v1.7.1 + github.com/kovidgoyal/imaging v1.7.2 github.com/seancfoley/ipaddress-go v1.7.1 github.com/shirou/gopsutil/v3 v3.24.5 github.com/zeebo/xxh3 v1.0.2 diff --git a/go.sum b/go.sum index e1b913c31..d09659a13 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,8 @@ github.com/kovidgoyal/exiffix v0.0.0-20250919160812-dbef770c2032 h1:TEV9lpo2a6fP github.com/kovidgoyal/exiffix v0.0.0-20250919160812-dbef770c2032/go.mod h1:VU38Nlbvb0lbyS5YkopCZMS5HuJ5QLVJBxRWyzq79q4= github.com/kovidgoyal/go-parallel v1.0.1 h1:nYUjN+EdpbmQjTg3N5eTUInuXTB3/1oD2vHdaMfuHoI= github.com/kovidgoyal/go-parallel v1.0.1/go.mod h1:BJNIbe6+hxyFWv7n6oEDPj3PA5qSw5OCtf0hcVxWJiw= -github.com/kovidgoyal/imaging v1.7.1 h1:wQJf0LdE06kIlSFIFFBKJp9N4D0CJmNMfWuog+YQka4= -github.com/kovidgoyal/imaging v1.7.1/go.mod h1:i0dBmu7j5/g4QhvS79Cx9IoiK7P02z1SwBJFDazrGLE= +github.com/kovidgoyal/imaging v1.7.2 h1:mmT6k6Az3mC6dbqdZ6Q9KQCdZFWTAQ+q97NyGZgJ/2c= +github.com/kovidgoyal/imaging v1.7.2/go.mod h1:GdkCORjfZMMGFY0Pb7TDmRhj7PDhxF/QShKukSCj0VU= github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a h1:N9zuLhTvBSRt0gWSiJswwQ2HqDmtX/ZCDJURnKUt1Ik= github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -50,8 +50,8 @@ github.com/shoenig/go-m1cpu v0.1.7 h1:C76Yd0ObKR82W4vhfjZiCp0HxcSZ8Nqd84v+HZ0qyI github.com/shoenig/go-m1cpu v0.1.7/go.mod h1:KkDOw6m3ZJQAPHbrzkZki4hnx+pDRR1Lo+ldA56wD5w= github.com/shoenig/test v1.7.0 h1:eWcHtTXa6QLnBvm0jgEabMRN/uJ4DMV3M8xUGgRkZmk= github.com/shoenig/test v1.7.0/go.mod h1:UxJ6u/x2v/TNs/LoLxBNJRV9DiwBBKYxXSyczsBHFoI= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= diff --git a/tools/utils/images/to_rgba.go b/tools/utils/images/to_rgba.go index 46c898c1d..5e6a68301 100644 --- a/tools/utils/images/to_rgba.go +++ b/tools/utils/images/to_rgba.go @@ -8,9 +8,12 @@ import ( "math" "github.com/kovidgoyal/imaging" + "github.com/kovidgoyal/kitty/tools/tty" ) var _ = fmt.Print +var debugprintln = tty.DebugPrintln +var _ = debugprintln func (self *Context) run_paste(src imaging.Scanner, background image.Image, pos image.Point, postprocess func([]byte)) { pos = pos.Sub(background.Bounds().Min) @@ -32,8 +35,8 @@ func (self *Context) run_paste(src imaging.Scanner, background image.Image, pos default: panic(fmt.Sprintf("Unsupported image type: %v", v)) } - if len(pix) != background.Bounds().Dy()*stride { - panic(fmt.Sprintf("background image has insufficient pixel data. Bounds: %v Stride: %d", background.Bounds(), stride)) + if len(pix) < background.Bounds().Dy()*stride { + panic(fmt.Sprintf("background image has insufficient pixel data. Bounds: %v Stride: %d Data len: %d", background.Bounds(), stride, len(pix))) } if err := self.SafeParallel(interRect.Min.Y, interRect.Max.Y, func(ys <-chan int) { for y := range ys {