← Back to team overview

kicad-developers team mailing list archive

Re: Possibility of uninitialised variable in RN_DATA::Add

 

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