veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.18k stars 219 forks source link

Possible overflow #405

Closed flga closed 5 years ago

flga commented 5 years ago

Hey, I was looking into removing unsafe.Pointer from Renderer.ReadPixels and I stumbled upon this.

Isn't it overriding arbitrary memory?

flga commented 5 years ago

Took a look at the docs, which state "This is filled in with a pointer to the locked pixels, appropriately offset by the locked area" (regarding the data pointer). ReadPixels docs state "A pointer to be filled in with the pixel data"

I assumed SDL wrote to it, as in read pixels.

veeableful commented 5 years ago

Hi @flga, I really appreciate the continuous care you give to this project! That certainly would be a nice design improvement to make. Will you be creating a PR for it?

flga commented 5 years ago

@veeableful it's a very useful lib, it's my pleasure :) Yep, i'll work on it today, I just need to think a little bit more on how to test it properly.