[fixed]references to NULL

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
floriang
Posts: 13
Joined: Mon Jul 14, 2014 12:03 pm

[fixed]references to NULL

Post by floriang »

Hello,
I found that there were references to null pointers in the irrlicht code (using 1.9.0 on openGL ES branch).
This is undefined behaviour and it may causes bugs if the cases occur.
I think it's pretty minor but just so you know:

You can find the offending code snippets bellow:

Code: Select all

 
 core::plane3df& COGLES2Driver::getClipPlane(irr::u32 index) const
{
        if (index < UserClipPlane.size())
            return UserClipPlane[index].Plane;
        else
            return *((core::plane3df*)0);  // reference from null?
}
 
//! returns the axis aligned bounding box of this node
const core::aabbox3d<f32>& CSceneManager::getBoundingBox() const
{
    _IRR_DEBUG_BREAK_IF(true) // Bounding Box of Scene Manager wanted.
 
    // should never be used.
    return *((core::aabbox3d<f32>*)0); // reference from null?
}
 
const SLight& CNullDriver::getDynamicLight(u32 idx) const
{
    if ( idx < Lights.size() )
        return Lights[idx];
    else
        return *((SLight*)0);
}
 
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: references to NULL

Post by CuteAlien »

Thanks. I guess the idea was to cause a crash - but you are right - that's just undefined.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: references to NULL

Post by CuteAlien »

Fixed in trunk r5112 and partly in ogl-es branch in r5113. Still needs a merge from trunk to ogl-es to fix all cases there. Unfortunately that still might take a while because there is another blocker currently which prevents me from merging those.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply