Bug 695

Summary: Buffer underflow in WindowsWGLGraphicsConfiguration
Product: [JogAmp] Jogl Reporter: rjbogue
Component: windowsAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: ---    
Version: 2   
Hardware: pc_x86_64   
OS: windows   
Type: --- SCM Refs:
jogl 7f2637bfe5ef1764882a123a8942e60632730bdf
Workaround: ---

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);