[dia] Avoid line number overflow in text_distance_from()



commit 38aa037eb73e86f7d8936646314e5a2d45d03746
Author: Hans Breuer <hans breuer org>
Date:   Sat Jul 12 10:21:42 2014 +0200

    Avoid line number overflow in text_distance_from()

 lib/text.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/lib/text.c b/lib/text.c
index 261e929..4660308 100644
--- a/lib/text.c
+++ b/lib/text.c
@@ -519,6 +519,8 @@ text_distance_from(Text *text, Point *point)
   } else {
     dy = 0.0;
     line = (int) floor( (point->y - topy) / text->height );
+    if (line >= text->numlines)
+      line = text->numlines - 1;
   }
 
   left = text->position.x;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]