kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #26407
Re: Possibility of uninitialised variable in RN_DATA::Add
-
To:
kicad-developers@xxxxxxxxxxxxxxxxxxx
-
From:
Wayne Stambaugh <stambaughw@xxxxxxxxx>
-
Date:
Fri, 23 Sep 2016 14:33:23 -0400
-
In-reply-to:
<CAG1r56Lu-7s=-=juG+0-qsgvQwJbCjO2pO898_r_GbkYYJsziQ@mail.gmail.com>
-
User-agent:
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0
Orson,
Please verify this patch when you get a chance. It looks correct to me
but I believe this is your code so I would prefer you to confirm it.
Thanks,
Wayne
On 9/23/2016 2:01 PM, John Beard wrote:
> Hi,
>
> If RN_DATA::Add is called with a BOARD_ITEM* aItem where
> aItem->IsConnected() fails (and it's not a module or netinfo item),
> the index into the vector is uninitialised, which could segfault the
> vector access.
>
> The attached patch initialises it to the ORPHANED value, and then
> makes sure it's been set to something valid so the vector can be
> safely indexed.
>
> I also added an assert to document that all paths (i.e. first if
> statement) must correctly lengthen the vector if needed.
>
> Cheers,
>
> John
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
References