From 29c473cb3ec704e9cc144066dc2f097c17494542 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 27 Aug 2010 10:51:14 +1000 Subject: [PATCH] freetype-go: Fix panic when drawing a span to the right of the bounding rect. This bug was introduced when an image.RGBA's representation went from slice of slices to one linear buffer. R=r CC=golang-dev http://codereview.appspot.com/2020044 --- freetype/raster/paint.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/freetype/raster/paint.go b/freetype/raster/paint.go index f2f093b..ff1943c 100644 --- a/freetype/raster/paint.go +++ b/freetype/raster/paint.go @@ -105,6 +105,9 @@ func (r *RGBAPainter) Paint(ss []Span, done bool) { if s.X1 > b.Max.X { s.X1 = b.Max.X } + if s.X0 >= s.X1 { + continue + } base := s.Y * r.Image.Stride p := r.Image.Pix[base+s.X0 : base+s.X1] for i, rgba := range p {