Fresco/Berlin/modules/Layout GridImpl.cc,1.30,1.31

Nick Lewycky <[email protected]> Sat, 18 Oct 2003 13:59:58 +0000
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Berlin/modules/Layout
In directory purcel:/tmp/cvs-serv22488

Modified Files:
	GridImpl.cc 
Log Message:
Check range of access to Layout::Grid from indicies given to us from client.
Patch from rohara closes bug49.


Index: GridImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/GridImpl.cc,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- GridImpl.cc	5 Jan 2003 16:21:33 -0000	1.30
+++ GridImpl.cc	18 Oct 2003 13:59:54 -0000	1.31
@@ -304,7 +304,8 @@
 
 void GridImpl::replace(Graphic_ptr g, const Layout::Grid::Index &i)
 {
-  Graphic_ptr old = _dimensions[xaxis].children[i.col][i.row];
+  // use at(n) for ranged checked access throws out_of_range
+  Graphic_ptr old = _dimensions[xaxis].children.at(i.col).at(i.row);
   if (!CORBA::is_nil(old))
     try { old->remove_parent_graphic(index_to_tag(i));}
     catch (const CORBA::OBJECT_NOT_EXIST &) {}