Fix crash when bad autorecode /blank is encountered.
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 26 Apr 2020 12:59:11 +0000 (14:59 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 26 Apr 2020 12:59:11 +0000 (14:59 +0200)
Closes bug #58255.

src/language/stats/autorecode.c
tests/language/stats/autorecode.at

index c093b1e6ab7af66245f47183f5e2d6c75ce03505..91fffcf27a07158b8f78ffa9bc1833fb2e428aba 100644 (file)
@@ -491,9 +491,10 @@ arc_free (struct autorecode_pgm *arc)
         }
 
       size_t n_rec_items =
-        (arc->n_specs == 1 || arc->specs[0].items == arc->specs[1].items
+        (arc->n_specs >= 2 && arc->specs[0].items == arc->specs[1].items
          ? 1
          : arc->n_specs);
+
       for (size_t i = 0; i < n_rec_items; i++)
         {
           struct arc_spec *spec = &arc->specs[i];
index 42f3cd32c0c9dc5cad19245bc7101562ac760306..7e886fa08cdb06e8ecddee8b3bde2ef37e924b68 100644 (file)
@@ -522,3 +522,24 @@ x,y
 8,4
 ])
 AT_CLEANUP
+
+
+AT_SETUP([AUTORECODE with /BLANK without specifier])
+
+AT_DATA([autorecode.sps], [data list notable list /x (a18).
+begin data
+one
+two
+three
+end data.
+
+* /BLANK should be either =MISSING or =VALID
+autorecode x /into y
+ /blank
+
+execute.
+])
+
+AT_CHECK([pspp -O format=csv autorecode.sps], [1], [ignore])
+
+AT_CLEANUP