Restrict internal lat/lon values in coord line drawing so it doesn't go into 
loops of potentially *massive* iteratations.
---
 src/vikcoordlayer.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/vikcoordlayer.c b/src/vikcoordlayer.c
index 2302d65..78fd93e 100644
--- a/src/vikcoordlayer.c
+++ b/src/vikcoordlayer.c
@@ -332,6 +332,17 @@ void vik_coord_layer_draw ( VikCoordLayer *vcl, gpointer 
data )
       max.lat = (topleft.lat > topright.lat) ? topleft.lat : topright.lat;
     }
 
+    /* Can zoom out more than whole world and so the above can give invalid 
positions */
+    /* Restrict values properly so drawing doesn't go into a near 'infinite' 
loop */
+    if ( min.lon < -180.0 )
+      min.lon = -180.0;
+    if ( max.lon > 180.0 )
+      max.lon = 180.0;
+    if ( min.lat < -90.0 )
+      min.lat = -90.0;
+    if ( max.lat > 90.0 )
+      max.lat = 90.0;
+
     lon = ((double) ((long) ((min.lon)/ vcl->deg_inc))) * vcl->deg_inc;
     ll.lon = ll2.lon = lon;
 
-- 
1.7.1


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to