DATA LIST: Fix assertion when RECORDS given twice with decreasing value.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 6 Oct 2021 04:57:37 +0000 (21:57 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 6 Oct 2021 04:57:37 +0000 (21:57 -0700)
Fixes bug #61285.
Thanks to Irfan Ariq for reporting this bug.

src/language/data-io/data-list.c

index b6dc078985258011561bace4ddfcd59e91aff9c3..a6ed9563028ccca519ec4f5a68fd0ff13262c606 100644 (file)
@@ -118,6 +118,11 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds)
        }
       else if (lex_match_id (lexer, "RECORDS"))
        {
+          if (data_parser_get_records (parser) > 0)
+            {
+              lex_sbc_only_once ("RECORDS");
+              goto error;
+            }
          lex_match (lexer, T_EQUALS);
          lex_match (lexer, T_LPAREN);
          if (!lex_force_int_range (lexer, "RECORDS", 0, INT_MAX))
@@ -143,7 +148,7 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds)
             }
          if (end)
            {
-             msg (SE, _("The %s subcommand may only be specified once."), "END");
+              lex_sbc_only_once ("END");
              goto error;
            }