PR for bug in wxImage:getRed/3

Hi, I found a bug in wxImage’s pixel related functions:

When wxImage:getRed(Image, X, Y) is called on a pixel of rgb(250, 250, 250), it returns 4294967290 (16#FFFFFFFA) instead of 250 (16#FA). The pixel is recognized as a signed char and got sign extended and converted to a unsigned int somehow.

I read the doc of wxWidget and found the prototype of that function is:

unsigned char 	GetRed (int x, int y) const

It return unsigned char which shouldn’t cause this problem. Then I found this piece of code in OTP:

char Result = This->GetRed(x,y);
...
rt.send( rt.make_uint(Result));

This is the cause of the problem. Changing the char to unsigned char fixed the problem.

I have submitted a PR on Github, what should i do next?

Just wait for us (me) to have time to take care of it, or give you further instructions on git-hub.

1 Like