Properly handle empty DO REPEAT...END REPEAT block. Fixes bug #18407.
authorBen Pfaff <blp@gnu.org>
Fri, 1 Dec 2006 06:02:35 +0000 (06:02 +0000)
committerBen Pfaff <blp@gnu.org>
Fri, 1 Dec 2006 06:02:35 +0000 (06:02 +0000)
Thanks to John Darrington for reporting this bug.

src/language/control/ChangeLog
src/language/control/repeat.c
tests/ChangeLog
tests/automake.mk

index 50707bd4f244b089565f727bdc1045836e3e9faf..17d3b510824d889bc24501fce5a453e88f6518a9 100644 (file)
@@ -1,3 +1,9 @@
+Thu Nov 30 22:01:27 2006  Ben Pfaff  <blp@gnu.org>
+
+       * repeat.c (do_repeat_read): Properly handle empty DO REPEAT...END
+       REPEAT block.  Fixes bug #18407.  Thanks to John Darrington for
+       reporting this bug.
+
 Sat Oct 28 16:18:48 WST 2006 John Darrington <john@darrington.wattle.id.au>
 
        * repeat.c: Eliminated references to extern variable getl_buf.
index 796c6e9354702bd5815cd83093a8793b4cc07ac6..951c0094eb252d287e7a08e78531c1dc76ad3891 100644 (file)
@@ -549,6 +549,8 @@ do_repeat_read  (struct getl_interface *b, struct string *output)
       if (block->loop_idx >= block->loop_cnt)
         return false;
       block->cur_line = block->first_line;
+      if (block->cur_line == NULL)
+        return false;
     }
   line = block->cur_line;
 
index d5d2305bebabd57d2b6340220a0b5f750485feb0..e6696c452d938614987e30f9c2a4a75629827857 100644 (file)
@@ -1,3 +1,9 @@
+Thu Nov 30 22:01:57 2006  Ben Pfaff  <blp@gnu.org>
+
+       * automake.mk: Add new test.
+
+       * tests/bugs/empty-do-repeat: New test, for bug #18407.
+
 Wed Nov 22 06:28:04 2006  Ben Pfaff  <blp@gnu.org>
 
        * tests/bugs/signals.sh: Fix race condition.
index ebefbf48dca2021243dd2f0baeb69f937d840abc..54d7c326228a92553931d508ff15f9208e9c843b 100644 (file)
@@ -85,6 +85,7 @@ TESTS = \
        tests/bugs/curtailed.sh \
        tests/bugs/data-crash.sh \
        tests/bugs/double-frequency.sh \
+       tests/bugs/empty-do-repeat.sh \
        tests/bugs/get.sh \
        tests/bugs/examine-1sample.sh \
        tests/bugs/examine-missing.sh \