← Back to team overview

yade-dev team mailing list archive

Re: [Bug 759481] Re: Possible "wrong memory access" in many places

 

So, you mean, that we need to add only:
if (!B) continue;

right?
And there is no sense for interactions.

Anton



On Wed, Apr 13, 2011 at 9:16 AM, Sergei D. <dorofeenko@xxxxxxxxx> wrote:
> 13.04.2011 10:36, Anton Gladky:
>>
>> Is it ok for everybody to fix the code by this way?
>> There is almost everywhere "if(!I->isReal()) continue;", but it
>> insufficient, probably...
>>
>
> This is not a case.
> If you look at BodyContainer::erase and InteractionContainer::erase you will
> see differencies.
> For BodyContainer::erase we have:
>
> 122 body[id]=shared_ptr<Body>();
>
> So a case "if !B" is adequate for it.
> But for InteractionContainer::erase we have:
>
> 54 if (linIx<(int)currSize-1) {
> 55 linIntrs[linIx]=linIntrs[currSize-1];
> 56 linIntrs[linIx]->linIx=linIx; // update the back-reference inside the
> interaction
> 57 }
> 58 //assert(linIntrs.size()==currSize);
> 59 // in either case, last element can be removed now
> 60 linIntrs.resize(--currSize); // currSize updated
>
> So "if !I" is have no sense from this point.
> The bug is in another place (if any).
>
> --
> Best regards,
>
> Sergei Dorofeenko,
> Cand. Phys.-Mat. Sci.
>
> Institute of Problems of Chemical Physics,
> Chernogolovka, Moscow region, Russia.
>
> e-mail: dorofeenko@xxxxxxxxx
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this bug notification because you are a member of Yade
developers, which is the registrant for Yade.
https://bugs.launchpad.net/bugs/759481

Title:
  Possible "wrong memory access" in many places

Status in Yet Another Dynamic Engine:
  New

Bug description:
  Jan Stransky has found and fixed a bug, which leads to wrong memory
  access [1].

  If we "grep" the code, we will find a lot of places, where the same
  issue can appear. See the attachment, this is the output only for
  "Interactions".

  I think, we have to put those "if(!I) continue;" and "if (!B)
  continue;" everywhere to escape crashes.


  [1] http://bazaar.launchpad.net/~yade-dev/yade/trunk/revision/2809



References