Thanks to Zhou Geng for reporting this bug as poc6 in the report here:
https://lists.gnu.org/archive/html/bug-gnu-pspp/2024-03/msg00015.html
const struct pivot_axis *layer_axis = &pt->axes[PIVOT_AXIS_LAYER];
if (print && pt->look->print_all_layers)
return pivot_axis_iterator_next (indexes, layer_axis);
- else if (!indexes)
+ else if (!indexes && layer_axis->extent)
{
size_t size = layer_axis->n_dimensions * sizeof *pt->current_layer;
return size ? xmemdup (pt->current_layer, size) : xmalloc (1);
╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
])
AT_CLEANUP
+
+AT_SETUP([CTABLES crash with all-missing data])
+AT_DATA([ctables.sps], [dnl
+DATA LIST LIST NOTABLE/a.
+BEGIN DATA.
+.
+END DATA.
+
+* The final one below previously crashed.
+CTABLES/TAB A.
+CTABLES/TAB BY A.
+CTABLES/TAB BY BY A.
+])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
+Custom Tables
+
+Custom Tables
+])
+AT_CLEANUP
\ No newline at end of file