Crashes on OS X in glReadPixels

Hello everybody-

On OS X 10.3.9 I keep getting crashes using the JSR-231 beta.
After generating an image in a GLCanvas, I’m trying to access its pixel values like so:

IntBuffer result = IntBuffer.allocate(w * h);
gl.glReadPixels(0, 0, w, h, GL.GL_RGB, GL.GL_INT, result);

During the glReadPixels call it crashes with the following log entry:

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : Bus Error occurred at PC=0x90D9F704
Function=[Unknown.]
Library=/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib

NOTE: We are unable to locate the function name symbol for the error
	  just occurred. Please refer to release documentation for possible reason and solutions.

Current Java thread:
	at com.sun.opengl.impl.GLImpl.glReadBuffer(Native Method)
	at RendererJM.getPixels(RendererJM.java:65)
	at Lesson01JM_.run(Lesson01JM_.java:63)
	at java.lang.Thread.run(Thread.java:552)

I also tried JOGL 1.1.1 (using an int[w * h] instead of the IntBuffer), but got the
same result. Has anybody seen this, and knows what it might be related to?

Thanks,
Ulf

We should be checking the lengths of the arrays / buffers passed down to calls like this but aren’t yet. Your IntBuffer isn’t big enough to hold the data you’re reading. Either allocate it with size 3wh (one int for each of r, g, and b) or allocate a ByteBuffer and read GL_UNSIGNED_BYTE instead of GL_INT type.