Ticket #4650: term-line-overflow.patch

File term-line-overflow.patch, 679 bytes (added by joshe, 15 years ago)

Fix possible line width overflow in BasicTerminalBuffer::_InsertGap()

  • src/apps/terminal/BasicTerminalBuffer.cpp

    commit 145520a71dc40c1aca040b467f3831bc2b9c9d78
    Author: Joshua R. Elsasser <joshua@elsasser.org>
    Date:   Sat Sep 26 21:13:51 2009 +0000
    
        In _InsertGap(), be sure not to set a line's length longer than the space allocated for it.
    
    diff --git a/src/apps/terminal/BasicTerminalBuffer.cpp b/src/apps/terminal/BasicTerminalBuffer.cpp
    index 6470031..41f85fa 100644
    a b BasicTerminalBuffer::_InsertGap(int32 width)  
    13521352            line->cells + fCursor.x, toMove * sizeof(TerminalCell));
    13531353    }
    13541354
    1355     line->length += width;
     1355    line->length = min_c(line->length + width, fWidth);
    13561356}
    13571357
    13581358