From 0faa5567caf8487a7b08541abea98197775c0b58 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 9 Mar 2017 23:40:34 +0000 Subject: [PATCH] Fix crash on non utf8 files trigering highlighting of backward ranges Fixes #1274 --- src/highlighters.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/highlighters.cc b/src/highlighters.cc index f3cc1baa..8fef89ca 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -30,7 +30,8 @@ void highlight_range(DisplayBuffer& display_buffer, BufferCoord begin, BufferCoord end, bool skip_replaced, T func) { - if (begin == end or end <= display_buffer.range().begin + // tolerate begin > end as that can be triggered by wrong encodngs + if (begin >= end or end <= display_buffer.range().begin or begin >= display_buffer.range().end) return;