[fixed] CAttributeImpl.h CEnumAttribute::getInt()

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
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

[fixed] CAttributeImpl.h CEnumAttribute::getInt()

Post by luthyr »

Shouldn't

Code: Select all

 
virtual s32 getInt() _IRR_OVERRIDE_
 {
     for (s32 i=0; EnumLiterals.size(); ++i)
         if (Value.equals_ignore_case(EnumLiterals[i]))
         {
             return i;
         }
 
     return -1;
 }
 
be

Code: Select all

 
virtual s32 getInt() _IRR_OVERRIDE_
{
    for (u32 i=0; i < EnumLiterals.size(); ++i)
        if (Value.equals_ignore_case(EnumLiterals[i]))
        {
            return i;
        }
    return -1;
}
 
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: CAttributeImpl.h CEnumAttribute::getInt() for loop wrong

Post by CuteAlien »

Yeah, I agree. Fixed in svn trunk r5306. Thanks for reporting!
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
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

Re: [fixed] CAttributeImpl.h CEnumAttribute::getInt()

Post by luthyr »

I saw this was changed, but the key difference I was reporting is missing:

i < EnumLiterals.size()

It's been several days since I looked at this, but I think the reason I was reporting it was because at some point I encountered a crash because it went passed the bounds of EnumLiterals.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [fixed] CAttributeImpl.h CEnumAttribute::getInt()

Post by CuteAlien »

Argh - the problem when there are 2 changes in one line.
I didn't see the real bug and thought you just switched u32 and s32 :-)
Hm, this fix even belongs in 1.8 branch - so fixed there for now. Merge with trunk will follow next days.
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
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

Re: [fixed] CAttributeImpl.h CEnumAttribute::getInt()

Post by luthyr »

Yeah, sorry about that. :P
Post Reply