From 509788460889ed934e4a51d03243aedf776e8b96 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 23 Jan 2023 17:39:40 +1100 Subject: [PATCH] Fix crash in TabulationHighlighter when wrapping just after a tab --- src/highlighters.cc | 3 +++ test/regression/0-crash-on-tab-just-before-wrap-column/cmd | 1 + test/regression/0-crash-on-tab-just-before-wrap-column/in | 1 + test/regression/0-crash-on-tab-just-before-wrap-column/rc | 1 + 4 files changed, 6 insertions(+) create mode 100644 test/regression/0-crash-on-tab-just-before-wrap-column/cmd create mode 100644 test/regression/0-crash-on-tab-just-before-wrap-column/in create mode 100644 test/regression/0-crash-on-tab-just-before-wrap-column/rc diff --git a/src/highlighters.cc b/src/highlighters.cc index 6d8eac7e..9d733521 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1017,6 +1017,9 @@ struct TabulationHighlighter : Highlighter ++atom_it; } } + + if (atom_it == line.end()) + break; } } } diff --git a/test/regression/0-crash-on-tab-just-before-wrap-column/cmd b/test/regression/0-crash-on-tab-just-before-wrap-column/cmd new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/regression/0-crash-on-tab-just-before-wrap-column/cmd @@ -0,0 +1 @@ + diff --git a/test/regression/0-crash-on-tab-just-before-wrap-column/in b/test/regression/0-crash-on-tab-just-before-wrap-column/in new file mode 100644 index 00000000..ced27a60 --- /dev/null +++ b/test/regression/0-crash-on-tab-just-before-wrap-column/in @@ -0,0 +1 @@ +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrapped diff --git a/test/regression/0-crash-on-tab-just-before-wrap-column/rc b/test/regression/0-crash-on-tab-just-before-wrap-column/rc new file mode 100644 index 00000000..96a09981 --- /dev/null +++ b/test/regression/0-crash-on-tab-just-before-wrap-column/rc @@ -0,0 +1 @@ +addhl global/ wrap