D14106: Move search line upper bound check to less generic function
    Mariusz Glebocki 
    noreply at phabricator.kde.org
       
    Sat Jul 14 01:09:05 BST 2018
    
    
  
mglb created this revision.
mglb added a reviewer: Konsole.
mglb added a project: Konsole.
mglb requested review of this revision.
REVISION SUMMARY
  When there was at least one search attempt, search box is still opened,
  and the screen and/or history is cleared, there is a high chance that
  the line number remembered by the search is invalid. The line number is
  used as the lines array index, so this can lead to overflow and crash.
  
  This is at this moment fixed with a check in `copyLineToStream()`, which
  is a generic function that happens to be used by search function and
  where the line number is used. There still is an `assert` which is
  triggered in debug builds.
  
  The patch moves the check directly to a search function, where the line
  number is initialized before first search.
TEST PLAN
  You have to do the test in debug build - there is a hack in
  `copyLineToStream()` which prevents crash, but `assert` before it
  catches an error condition.
  
  - Run `seq 5000`
  - Open search box, search for `000`
  - Clear screen/history
  - Search up/down
  
  Actual result: Crash
  Expected result: Search should begin from last/first visible line
REPOSITORY
  R319 Konsole
BRANCH
  arc/move-search-line-upper-bound-check-to-less-generic-function (branched from master)
REVISION DETAIL
  https://phabricator.kde.org/D14106
AFFECTED FILES
  src/Screen.cpp
  src/SessionController.cpp
To: mglb, #konsole
Cc: konsole-devel, herrold, ngraham, maximilianocuria, hindenburg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20180714/41ee0651/attachment-0001.html>
    
    
More information about the konsole-devel
mailing list