← Back to team overview

kicad-developers team mailing list archive

Re: Possibility of uninitialised variable in RN_DATA::Add

 

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