Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Src bounds checking fails and Transform results in index out of range panics #1

Closed
grokify opened this issue Feb 25, 2022 · 1 comment
Labels
bug Something isn't working priority-medium medium priority

Comments

@grokify
Copy link
Owner

grokify commented Feb 25, 2022

What steps will reproduce the problem?

  1. Compile the following program
package main

import "image"
import "graphics-go.googlecode.com/hg/graphics"

func main() {
    src := image.NewGray(image.Rect(50,50,60,60))
    dst := image.NewGray(image.Rect(0,0,100,100))
    graphics.I.Transform(dst, src)
}
  1. Run it.

What is the expected output? What do you see instead?

Absolutely nothing. Instead I get:

panic: runtime error: index out of range

goroutine 1 [running]:
graphics-go%2egooglecode%2ecom/hg/graphics.binterpRGBA(0xf84001c870, 
0x3200000032, 0xf84001c570, 0x4049400000000000, 0x4049400000000000, ...)
    /Users/gunca/Code/go/src/pkg/graphics-go.googlecode.com/hg/graphics/bilinear.go:104 +0x5e4
graphics-go%2egooglecode%2ecom/hg/graphics.Affine.Transform(0x3ff0000000000000, 
0x0, 0x0, 0x0, 0x3ff0000000000000, ...)
    /Users/gunca/Code/go/src/pkg/graphics-go.googlecode.com/hg/graphics/affine.go:66 +0x348
main.main()
    /Users/gunca/Code/go-rotate/rotate.go:10 +0x144

What version of the product are you using? On what operating system?

hg identify -> d7322ae4d055+ weekly/weekly.2011-09-21
latest graphics-go on Snow Leopard

Copied from: https://code.google.com/archive/p/graphics-go/issues/1

@grokify grokify added bug Something isn't working priority-medium medium priority labels Feb 25, 2022
@grokify
Copy link
Owner Author

grokify commented Feb 25, 2022

No longer an issue with updated Transform() method:

func (a Affine) Transform(dst draw.Image, src image.Image, i interp.Interp) error

Example:

package main

import (
	"image"

	"github.com/grokify/graphics-go/graphics"
	"github.com/grokify/graphics-go/graphics/interp"
)

func main() {
	src := image.NewGray(image.Rect(50, 50, 60, 60))
	dst := image.NewGray(image.Rect(0, 0, 100, 100))
	graphics.I.Transform(dst, src, interp.Bilinear)
}

@grokify grokify closed this as completed Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-medium medium priority
Projects
None yet
Development

No branches or pull requests

1 participant