raster pushed a commit to branch master.

commit bbdf50fd627c7154c93e48ca46ec9567d54e176c
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Sat Apr 20 12:50:31 2013 +0900

    protect against segv. see comments.
---
 src/bin/termpty.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index afcea6f..1e93d52 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -765,7 +765,10 @@ static void
 _termpty_vertically_shrink(Termpty *ty, int old_w, int old_h,
                            Termcell *old_screen)
 {
-/*
+/* See the XXX: below - disable this line of protection:
+ *         if (offset < 0) offset = 0;
+ * and we get the following crash:
+ * 
  * - Open terminology
  * - Maximize (with Ctrl+Alt+n)
  * - Choose some repo
@@ -862,7 +865,10 @@ _termpty_vertically_shrink(Termpty *ty, int old_w, int 
old_h,
         len = real_h - to_history;
         pos = (len + ty->circular_offset) % old_h;
         offset = len - pos;
-
+        
+        // XXX: this is a segv protection... it may cause mis-drawing?
+        if (offset < 0) offset = 0;
+        
         /* 2 times */
         for (y = pos - 1; y >= 0; y--)
           {

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to