Hi

thanks for the detailed report, I'll have a look.

kind regards
  gerrit

On Thu, 2014-04-10 at 18:20 +0200, Marcel Weiler wrote:
> Hi,
> 
> I have found a bug in OSGShaderProgram.cpp:
> If you set a shader source of a (Simple)SHLChunk to an invalid source 
> code, ShaderProgram::handleGL(...) will delete the shader in line 
> Snippet 769 and uiShader will be set to 0. If you then set the shader 
> source to a valid source again, uiShader will still be 0 and no new 
> shader is created.
> Because there is no shader object to compile, the compilation of the new 
> shader source will fail (line 723). OpenSG then tries to get the error 
> log. In line 732 it queries GL_INFO_LOG_LENGTH, but uiShader is still 0 
> and so the returned value in iDebugLength is invalid. In my case 
> iDebugLength was negative, which when OpenSG tries to reserve a buffer, 
> is cast into a very large unsigned number and causes a Snippet 
> std::bad_alloc.
> 
> Possible solution:
> Line 645 is a commented if-condition which once checked if uiShader 
> equals 0. The condition was replaced  with if(mode == 
> Window::initialize), but after initialization this condition always 
> evaluates to false.
> When by using the debugger I make the program go into the new if-block a 
> new shader object is created and everything works well again.
> I think both if-conditions should be combined with a logical OR ( if 
> (uiShader==0 || mode == Window::initialize) ). This should remove the bug.
> 
> The modified example file I attached to this mail causes the problem I 
> described. Initially a valid shader is active. If you press 'x', an 
> invalid vertex-shader source will be passed to the SimpleSHLChunk. Until 
> then nothing bad happens. If you press 'x' again, the original, valid 
> shader source is passed to the SimpleSHLChunk again and the program crashes.
> 
> I hope the information I provided helps to solve the problem.
> 
> Kind Regards,
> Marcel
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment 
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees
> _______________________________________________
> Opensg-users mailing list
> Opensg-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensg-users

-- 

Gerrit Voß
盖瑞客
---------------------------------------------------
Fraunhofer IDM @ NTU
南洋理工大学, Nanyang Technological University, (NTU)
新加坡,      Singapore
--------------------------------------------------

If we communicate everything we ever think, speech 
just becomes static. And all of us become bores.

J. Clarkson



------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to