From d290967fb1b127cd5c69958ec490e235b49087d5 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 20 Jun 2020 16:11:32 +0200 Subject: [PATCH] Add a test for bug #58591 --- src/libpspp/u8-line.c | 3 +++ tests/output/ascii.at | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/libpspp/u8-line.c b/src/libpspp/u8-line.c index 3b4f9c60c4..1374314a11 100644 --- a/src/libpspp/u8-line.c +++ b/src/libpspp/u8-line.c @@ -122,6 +122,9 @@ u8_line_find_pos (const struct u8_line *line, int target_x, struct u8_pos *c) } x += w; } + + /* This can happen if there are non-printable characters + in the line. */ c->x1 = x; c->ofs1 = ofs; return false; diff --git a/tests/output/ascii.at b/tests/output/ascii.at index fb7a8969dc..f966fc6f06 100644 --- a/tests/output/ascii.at +++ b/tests/output/ascii.at @@ -688,3 +688,22 @@ execute. AT_CHECK([pspp print.sps], [0], [ignore]) AT_CLEANUP + + + +dnl A crash has been observed when the first character +dnl of a string is U+0008 +AT_SETUP([ASCII crash on non-printables]) + +AT_DATA([nonprint.sps], [dnl +DATA LIST FREE /s8 (a8). +BEGIN DATA. +xxxxxx zzz a qqq +END DATA. + +LIST. +]) + +AT_CHECK([pspp nonprint.sps], [0], [ignore]) + +AT_CLEANUP -- 2.30.2