kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #26438
Re: Possibility of uninitialised variable in RN_DATA::Add
-
To:
John Beard <john.j.beard@xxxxxxxxx>, Kicad Developers <kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
From:
Maciej Sumiński <maciej.suminski@xxxxxxx>
-
Date:
Sun, 25 Sep 2016 19:41:18 +0200
-
Authentication-results:
spf=pass (sender IP is 188.184.36.48) smtp.mailfrom=cern.ch; lists.launchpad.net; dkim=none (message not signed) header.d=none;lists.launchpad.net; dmarc=bestguesspass action=none header.from=cern.ch;
-
In-reply-to:
<CAG1r56Lu-7s=-=juG+0-qsgvQwJbCjO2pO898_r_GbkYYJsziQ@mail.gmail.com>
-
Spamdiagnosticmetadata:
NSPM
-
Spamdiagnosticoutput:
1:99
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0
Hi John,
Good catch, thank you for the patch. I have just committed it and
simplified the related code parts a bit.
Regards,
Orson
On 09/23/2016 08: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
>
Attachment:
signature.asc
Description: OpenPGP digital signature
References