Bug 695 - Buffer underflow in WindowsWGLGraphicsConfiguration
Summary: Buffer underflow in WindowsWGLGraphicsConfiguration
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: windows (show other bugs)
Version: 2
Hardware: pc_x86_64 windows
: --- blocker
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2013-02-28 19:50 CET by rjbogue
Modified: 2013-02-28 20:43 CET (History)
0 users

See Also:
Type: ---
SCM Refs:
jogl 7f2637bfe5ef1764882a123a8942e60632730bdf
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rjbogue 2013-02-28 19:50:29 CET
I encountered a case on an NVidia Quadro 3500 fx where the call to WGLExt.wglChoosePixelFormatARB in WindowsWGLGraphicsConfiguration (currently line 355) returns 264 in numFormatsTmp despite 256 being passed in for the maximum number of formats. This results in a buffer underflow on line 368 since pformatsTmp only has 256 values and it's trying to copy 264 values.

I recommend the following change to account for this bug in the driver:

< final int numFormats = numFormatsTmp.get(0);
---
> final int numFormats = Math.min(numFormatsTmp.get(0), WindowsWGLGraphicsConfiguration.MAX_PFORMATS);