From 3bb2249f3452061247655a11696a93dc5eeae584 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 9 Dec 2021 14:26:25 -0500 Subject: layout: Handle a corner case We can't break in a tab run. This fixes an assertion found by afl. Testcase included. Fixes: #638 --- tests/layouts/tab-assert.layout | 183 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 tests/layouts/tab-assert.layout (limited to 'tests/layouts/tab-assert.layout') diff --git a/tests/layouts/tab-assert.layout b/tests/layouts/tab-assert.layout new file mode 100644 index 00000000..0e3ebf25 --- /dev/null +++ b/tests/layouts/tab-assert.layout @@ -0,0 +1,183 @@ +{ + "context" : { + "font" : "serif 12", + "base-gravity" : "south", + "gravity-hint" : "natural", + "base-dir" : "weak-ltr", + "round-glyph-positions" : true, + "transform" : [ + 1, + 0, + 0, + 1, + 0, + 0 + ] + }, + "comment" : "This layout was triggering an assertion in process_line", + "text" : " \t ", + "width" : 0, + "output" : { + "is-wrapped" : false, + "is-ellipsized" : false, + "unknown-glyphs" : 0, + "width" : 56320, + "height" : 56320, + "log-attrs" : [ + { + "char-break" : true, + "white" : true, + "cursor-position" : true, + "sentence-boundary" : true, + "backspace-deletes-character" : true, + "expandable-space" : true, + "word-boundary" : true + }, + { + "line-break" : true, + "char-break" : true, + "white" : true, + "cursor-position" : true, + "word-boundary" : true + }, + { + "char-break" : true, + "white" : true, + "cursor-position" : true, + "backspace-deletes-character" : true, + "expandable-space" : true, + "word-boundary" : true + }, + { + "char-break" : true, + "white" : true, + "cursor-position" : true, + "expandable-space" : true + }, + { + "line-break" : true, + "mandatory-break" : true, + "char-break" : true, + "white" : true, + "cursor-position" : true, + "sentence-boundary" : true, + "word-boundary" : true + } + ], + "lines" : [ + { + "start-index" : 0, + "length" : 4, + "paragraph-start" : true, + "direction" : "ltr", + "runs" : [ + { + "offset" : 0, + "length" : 1, + "text" : " ", + "bidi-level" : 0, + "gravity" : "south", + "language" : "en-us", + "script" : "common", + "font" : { + "description" : "DejaVu Sans 12", + "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01", + "matrix" : [ + 1, + -0, + -0, + 1, + 0, + 0 + ] + }, + "flags" : 0, + "y-offset" : 0, + "start-x-offset" : 0, + "end-x-offset" : 0, + "glyphs" : [ + { + "glyph" : 3, + "width" : 5120, + "is-cluster-start" : true, + "log-cluster" : 0 + } + ] + }, + { + "offset" : 1, + "length" : 1, + "text" : "\t", + "bidi-level" : 0, + "gravity" : "south", + "language" : "en-us", + "script" : "common", + "font" : { + "description" : "DejaVu Sans 12", + "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01", + "matrix" : [ + 1, + -0, + -0, + 1, + 0, + 0 + ] + }, + "flags" : 0, + "y-offset" : 0, + "start-x-offset" : 0, + "end-x-offset" : 0, + "glyphs" : [ + { + "glyph" : 268435455, + "width" : 40960, + "is-cluster-start" : true, + "log-cluster" : 0 + } + ] + }, + { + "offset" : 2, + "length" : 2, + "text" : " ", + "bidi-level" : 0, + "gravity" : "south", + "language" : "en-us", + "script" : "common", + "font" : { + "description" : "DejaVu Sans 12", + "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01", + "matrix" : [ + 1, + -0, + -0, + 1, + 0, + 0 + ] + }, + "flags" : 0, + "y-offset" : 0, + "start-x-offset" : 0, + "end-x-offset" : 0, + "glyphs" : [ + { + "glyph" : 3, + "width" : 5120, + "is-cluster-start" : true, + "log-cluster" : 0 + }, + { + "glyph" : 3, + "width" : 5120, + "is-cluster-start" : true, + "log-cluster" : 1 + } + ] + } + ] + } + ] + } +} -- cgit v1.2.1