-# We sort the output into a predictable order because the lexer finds
-# and reports null bytes as soon as it reads them into its input
-# buffer, as opposed to when it encounters them during tokenization.
-# This also means that null bytes might be reported as part of one
-# command or another or none, hence removing the LIST: prefix.
-AT_CHECK([pspp -O format=csv lexer.sps > lexer.csv], [1])
-AT_CHECK([sed '/^$/d
-s/LIST: //' lexer.csv | sort], [0], [dnl
-lexer.sps: error: Bad character U+0000 in input.
-lexer.sps:1: error: Unknown command `datA dist'.
-lexer.sps:2: error: LIST is allowed only after the active dataset has been defined.
+AT_CHECK([pspp -O format=csv lexer.sps], [1], [dnl
+"lexer.sps:1.1-1.9: error: Unknown command `datA dist'.
+ 1 | datA dist list notable file='input.txt'/a b c.
+ | ^~~~~~~~~"
+
+"lexer.sps:2.1-2.3: error: LIST: LIST is allowed only after the active dataset has been defined.
+ 2 | lis|."
+
+"lexer.sps:2.6: error: LIST: Bad character U+0000 in input.
+ 2 | lis|."
+])
+AT_CLEANUP
+
+
+
+
+# Bug #54684
+AT_SETUP([lexer crash due to overflow])
+printf "DATA LIST/5555555555555555." > lexer.sps
+
+AT_CHECK([pspp -O format=csv lexer.sps], [1], [dnl
+"lexer.sps:1.11-1.26: error: DATA LIST: Syntax error expecting integer between 1 and 2147483647.
+ 1 | DATA LIST/5555555555555555.
+ | ^~~~~~~~~~~~~~~~"