[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.

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

Postby luthyr » Sun Jun 19, 2016 5:57 pm

Shouldn't

cpp 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

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

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

Postby CuteAlien » Sun Jun 19, 2016 6:29 pm

Yeah, I agree. Fixed in svn trunk r5306. Thanks for reporting!
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8528
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

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

Postby luthyr » Thu Jul 07, 2016 2:57 pm

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

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

Postby CuteAlien » Thu Jul 07, 2016 4:13 pm

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.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8528
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

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

Postby luthyr » Thu Jul 07, 2016 4:20 pm

Yeah, sorry about that. :P
luthyr
 
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 1 guest