Bug 524 - glMaterialfv crashes if color == null
Summary: glMaterialfv crashes if color == null
Status: RESOLVED WONTFIX
Alias: None
Product: Jogl
Classification: JogAmp
Component: opengl (show other bugs)
Version: 2
Hardware: pc_x86_64 linux
: --- minor
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2011-11-08 20:04 CET by t.mahlmann
Modified: 2011-11-27 20:48 CET (History)
0 users

See Also:
Type: ---
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description t.mahlmann 2011-11-08 20:04:08 CET
Doing a glMaterialfv call, e.g.
glMaterialfv( GL.GL_FRONT, GLLightingFunc.GL_AMBIENT, color, 0 ), lets the JVM crash if the color parameter is null and directly passed into the native function. On my system com.jogamp.opengl.impl.gl4.GL4bcImpl.dispatch_glMaterialfv1 provokes a segfault in the graphics driver (see log).

Possible solution: let glMaterialfv do a nullpointer check

Implementation-Title: Java Bindings for OpenGL Runtime Environment

Implementation-Version: 2.0-b11-20101213

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007ffca91dd441, pid=12740, tid=140723133142784
#
# JRE version: 6.0_26-b03
#

OS:wheezy/sid

uname:Linux 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64
libc:glibc 2.13 NPTL 2.13 

vm_info: Java HotSpot(TM) 64-Bit Server VM (20.1-b02) for linux-amd64 JRE (1.6.0_26-b03), built on May  4 2011 01:13:47 by "java_re" with gcc 3.2.2 (SuSE Linux)

Stack: [0x00007ffca84cd000,0x00007ffca85ce000],  sp=0x00007ffca85cb6d0,  free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [fglrx_dri.so+0x2c5441]  ukiCreateContext+0x2c5441

[error occurred during error reporting (printing native stack), id 0xb]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J  com.jogamp.opengl.impl.gl4.GL4bcImpl.dispatch_glMaterialfv1(IILjava/lang/Object;IZJ)V
j  com.jogamp.opengl.impl.gl4.GL4bcImpl.glMaterialfv(II[FI)V+99
j  dk.itu.cgr.sgdl.gameviewer.ui.WorldObjectRenderer.display(Ldk/itu/cgr/sgdl/gameviewer/components/GameBoard;Ljavax/media/opengl/GL2;ILjava/lang/Object;)V+146
Comment 1 Sven Gothel 2011-11-27 20:48:32 CET
We don't check GL arguments by their function's semantics,
since this would cause a huge overhead in processing time as well as in work to do.

Sometimes null values are allowed and desired, sometimes not.

A SIGSEGV for a null pointer access is not too bad, since it is save 
and not a security issue IMHO.