import assistant: fix variable width after guesser with output constraints
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>
Thu, 21 Nov 2024 12:25:10 +0000 (13:25 +0100)
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>
Thu, 21 Nov 2024 12:25:10 +0000 (13:25 +0100)
The current code fixes the guessed variable width according to
input constraints. But the data output stages checks the
width against output constraints. The minimum width for FMT_E
is 1 for input and 6 for output. When the guesser proposes FMT_E
with width 5, then 5 is chosen. With this patch, the width is
fixed to 6.

Thanks to Fatemeh Ilkhani for reporting the bug and providing a
csv that triggers the crash.

Closes: https://savannah.gnu.org/bugs/?66456
src/ui/gui/psppire-import-textfile.c

index 95251c7324e59550a91f0a6a979e4db15bcea158..3257d439e134f5c7f59e7203240de8a8711ed56a 100644 (file)
@@ -697,7 +697,7 @@ textfile_create_reader (PsppireImportAssistant *ia)
     {
       struct fmt_spec fs = fmt_guesser_guess (fg[i]);
 
-      fmt_fix (&fs, FMT_FOR_INPUT);
+      fmt_fix (&fs, FMT_FOR_OUTPUT);
 
       struct variable *var = dict_get_var (ia->dict, i);