Fix sloppy bound checking in `string-{ref,set!}' with the empty string.
authorLudovic Courtès <ludo@gnu.org>
Tue, 2 Dec 2008 18:42:39 +0000 (19:42 +0100)
committerLudovic Courtès <ludo@gnu.org>
Tue, 2 Dec 2008 18:52:13 +0000 (19:52 +0100)
commit3ae3166b2307ee8588aa9b422764b486ed02ad09
tree70092c15a1ebe07932c7a41f2bee0ccfdf35a5be
parent691343ead288625816175574d629f8b5c925fbab
Fix sloppy bound checking in `string-{ref,set!}' with the empty string.

* libguile/strings.c (scm_string_ref): Add proper range checking for the
  empty string.
  (scm_string_set_x): Likewise.
  Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>.

* test-suite/tests/strings.test ("string-ref"): New test prefix.
  ("string-set!")["empty string", "empty string and non-zero index",
  "out of range", "negative index", "regular string"]: New tests.

* NEWS: Update.
NEWS
libguile/strings.c
test-suite/tests/strings.test