------------------------------------------------------------
revno: 3708
committer: Bruno Chareyre <bruno.chare...@hmg.inpg.fr>
timestamp: Thu 2015-07-30 18:08:08 +0200
message:
  fix segfault when InteractionContainer::found() access out of bounds
modified:
  core/InteractionContainer.hpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/InteractionContainer.hpp'
--- core/InteractionContainer.hpp	2015-04-30 16:53:30 +0000
+++ core/InteractionContainer.hpp	2015-07-30 16:08:08 +0000
@@ -76,7 +76,9 @@
 		const shared_ptr<Interaction>& find(Body::id_t id1,Body::id_t id2);
 // 		bool found(Body::id_t id1,Body::id_t id2);
 		inline bool found(const Body::id_t& id1,const Body::id_t& id2){
-			assert(bodies); return (id1>id2)?(*bodies)[id2]->intrs.count(id1):(*bodies)[id1]->intrs.count(id2);}
+			assert(bodies);
+			if(id2>=(Body::id_t)bodies->size()) return false;
+			return (id1>id2)?(*bodies)[id2]->intrs.count(id1):(*bodies)[id1]->intrs.count(id2);}
 		// index access
 		shared_ptr<Interaction>& operator[](size_t id){return linIntrs[id];}
 		const shared_ptr<Interaction>& operator[](size_t id) const { return linIntrs[id];}

_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to