unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
Subject: Re: srfi-13 bug2
Date: Mon, 13 Sep 2004 21:30:46 +0200	[thread overview]
Message-ID: <87d60qkluh.fsf_-_@peder.flower> (raw)
In-Reply-To: <87oekam2lf.fsf_-_@peder.flower> (Jan Nieuwenhuizen's message of "Mon, 13 Sep 2004 20:43:40 +0200")

Jan Nieuwenhuizen writes:

> Found it.  It turns out that
>
>     guile -c '(string-contains "" "a")'
>
> hangs with guile CVS.  See fix below.

Too quick.  Same for string-contains-ci, of course.

Jan.


? do-diff
? doconf
Index: libguile/ChangeLog
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/ChangeLog,v
retrieving revision 1.2146
diff -p -u -r1.2146 ChangeLog
--- libguile/ChangeLog	8 Sep 2004 23:04:08 -0000	1.2146
+++ libguile/ChangeLog	13 Sep 2004 19:29:14 -0000
@@ -1,3 +1,9 @@
+2004-09-13  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* srfi-13.c (scm_string_contains, s_scm_string_contains_ci):
+	Bugfix: when subtracting unsigned values, make sure that result
+	does not wrap.
+
 2004-09-09  Kevin Ryde  <user42@zip.com.au>
 
 	* filesys.c, stime.c (_POSIX_C_SOURCE): Use this only on hpux, it
Index: libguile/srfi-13.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/srfi-13.c,v
retrieving revision 1.4
diff -p -u -r1.4 srfi-13.c
--- libguile/srfi-13.c	7 Sep 2004 13:48:49 -0000	1.4
+++ libguile/srfi-13.c	13 Sep 2004 19:29:15 -0000
@@ -2253,7 +2253,7 @@ SCM_DEFINE (scm_string_contains, "string
 				   5, start2, cstart2,
 				   6, end2, cend2);
   len2 = cend2 - cstart2;
-  while (cstart1 <= cend1 - len2)
+  while (cstart1 <= cend1 - len2 && cend1 >= len2)
     {
       i = cstart1;
       j = cstart2;
@@ -2299,7 +2299,7 @@ SCM_DEFINE (scm_string_contains_ci, "str
 				   5, start2, cstart2,
 				   6, end2, cend2);
   len2 = cend2 - cstart2;
-  while (cstart1 <= cend1 - len2)
+  while (cstart1 <= cend1 - len2 && cend1 >= len2)
     {
       i = cstart1;
       j = cstart2;

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2004-09-13 19:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1094681451.3785.368.camel@localhost>
     [not found] ` <87isan90sd.fsf@peder.flower>
2004-09-13 18:43   ` srfi-13 bug [WAS: guile-gnome-glib 2.3.993] Jan Nieuwenhuizen
2004-09-13 19:30     ` Jan Nieuwenhuizen [this message]
2004-09-22  1:15     ` srfi-13 bug Marius Vollmer
2004-09-22 20:22       ` Jan Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d60qkluh.fsf_-_@peder.flower \
    --to=janneke@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).