unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* segfault in guile 1.6.7
@ 2005-03-24 17:11 Alexey Voinov
  2005-03-25 20:37 ` Kevin Ryde
  2005-05-22 18:59 ` Marius Vollmer
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Voinov @ 2005-03-24 17:11 UTC (permalink / raw)



[-- Attachment #1.1.1: Type: text/plain, Size: 463 bytes --]

hi.

There's a bug in guile srfi-13 implementation. 

Steps to reproduce are:
$ guile
guile> (use-modules (srfi srfi-13))
guile> (string-index (string #\a) char-numeric?)
#f
guile> (string-index (string (integer->char 209)) char-numeric?)
zsh: 2760 segmentation fault  guile

I haven't checked if this bug is still present in cvs HEAD.
Patch attached.

-- 
Best Regards!
Alexey Voinov
             
voins@voins.program.ru
voins@altlinux.ru


[-- Attachment #1.1.2: guile-1.6.7-alt-unsigned.patch --]
[-- Type: text/plain, Size: 7439 bytes --]

--- guile-1.6.7/srfi/srfi-13.c.orig	2004-12-14 08:21:39 +0300
+++ guile-1.6.7/srfi/srfi-13.c	2005-03-23 21:57:37 +0300
@@ -61,7 +61,7 @@
 	    "successful application of @var{pred}.")
 #define FUNC_NAME s_scm_string_any
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
   SCM res;
 
@@ -108,7 +108,7 @@
 	    "application of @var{pred} to the last character of @var{s}.")
 #define FUNC_NAME s_scm_string_every
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
   SCM res;
 
@@ -189,7 +189,7 @@
 	    "Convert the string @var{str} into a list of characters.")
 #define FUNC_NAME s_scm_string_to_listS
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
   SCM result = SCM_EOL;
 
@@ -645,7 +645,7 @@
 	    "trimmed.")
 #define FUNC_NAME s_scm_string_trim
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
@@ -720,7 +720,7 @@
 	    "trimmed.")
 #define FUNC_NAME s_scm_string_trim_right
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
@@ -795,7 +795,7 @@
 	    "trimmed.")
 #define FUNC_NAME s_scm_string_trim_both
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
@@ -906,7 +906,7 @@
 	    "@var{i} is the first position that does not match.")
 #define FUNC_NAME s_scm_string_compare
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -949,7 +949,7 @@
 	    "character comparison is done case-insensitively.")
 #define FUNC_NAME s_scm_string_compare_ci
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -987,7 +987,7 @@
 	    "value otherwise.")
 #define FUNC_NAME s_scm_string_eq
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1022,7 +1022,7 @@
 	    "value otherwise.")
 #define FUNC_NAME s_scm_string_neq
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1057,7 +1057,7 @@
 	    "true value otherwise.")
 #define FUNC_NAME s_scm_string_lt
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1092,7 +1092,7 @@
 	    "true value otherwise.")
 #define FUNC_NAME s_scm_string_gt
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1127,7 +1127,7 @@
 	    "value otherwise.")
 #define FUNC_NAME s_scm_string_le
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1162,7 +1162,7 @@
 	    "otherwise.")
 #define FUNC_NAME s_scm_string_ge
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1198,7 +1198,7 @@
 	    "case-insensitively.")
 #define FUNC_NAME s_scm_string_ci_eq
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1234,7 +1234,7 @@
 	    "case-insensitively.")
 #define FUNC_NAME s_scm_string_ci_neq
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1270,7 +1270,7 @@
 	    "case-insensitively.")
 #define FUNC_NAME s_scm_string_ci_lt
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1306,7 +1306,7 @@
 	    "case-insensitively.")
 #define FUNC_NAME s_scm_string_ci_gt
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1342,7 +1342,7 @@
 	    "case-insensitively.")
 #define FUNC_NAME s_scm_string_ci_le
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1378,7 +1378,7 @@
 	    "case-insensitively.")
 #define FUNC_NAME s_scm_string_ci_ge
 {
-  char * cstr1, * cstr2;
+  unsigned char * cstr1, * cstr2;
   int cstart1, cend1, cstart2, cend2;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
@@ -1658,7 +1658,7 @@
 	    "@end itemize")
 #define FUNC_NAME s_scm_string_indexS
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
@@ -1717,7 +1717,7 @@
 	    "@end itemize")
 #define FUNC_NAME s_scm_string_index_right
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
@@ -1777,7 +1777,7 @@
 	    "@end itemize")
 #define FUNC_NAME s_scm_string_skip
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
@@ -1837,7 +1837,7 @@
 	    "@end itemize")
 #define FUNC_NAME s_scm_string_skip_right
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
 
   SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
@@ -1896,7 +1896,7 @@
 	    "@end itemize")
 #define FUNC_NAME s_scm_string_count
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
   int count = 0;
 
@@ -2442,7 +2442,7 @@
 	    "string elements is not specified.")
 #define FUNC_NAME s_scm_string_map
 {
-  char * cstr, *p;
+  unsigned char * cstr, *p;
   int cstart, cend;
   SCM result;
 
@@ -2473,7 +2473,7 @@
 	    "modified in-place, the return value is not specified.")
 #define FUNC_NAME s_scm_string_map_x
 {
-  char * cstr, *p;
+  unsigned char * cstr, *p;
   int cstart, cend;
 
   SCM_VALIDATE_PROC (1, proc);
@@ -2502,7 +2502,7 @@
 	    "result of @var{kons}' application.")
 #define FUNC_NAME s_scm_string_fold
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
   SCM result;
 
@@ -2529,7 +2529,7 @@
 	    "result of @var{kons}' application.")
 #define FUNC_NAME s_scm_string_fold_right
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
   SCM result;
 
@@ -2678,7 +2678,7 @@
 	    "return value is not specified.")
 #define FUNC_NAME s_scm_string_for_each
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
 
   SCM_VALIDATE_PROC (1, proc);
@@ -2914,7 +2914,7 @@
 	    "character set, it is tested for membership.")
 #define FUNC_NAME s_scm_string_filter
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
   SCM result;
   int idx;
@@ -2980,7 +2980,7 @@
 	    "character set, it is tested for membership.")
 #define FUNC_NAME s_scm_string_delete
 {
-  char * cstr;
+  unsigned char * cstr;
   int cstart, cend;
   SCM result;
   int idx;

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: segfault in guile 1.6.7
  2005-03-24 17:11 segfault in guile 1.6.7 Alexey Voinov
@ 2005-03-25 20:37 ` Kevin Ryde
  2005-03-25 20:47   ` Kevin Ryde
  2005-05-22 18:59 ` Marius Vollmer
  1 sibling, 1 reply; 7+ messages in thread
From: Kevin Ryde @ 2005-03-25 20:37 UTC (permalink / raw)
  Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

Alexey Voinov <voins@voins.program.ru> writes:
>
> guile> (string-index (string (integer->char 209)) char-numeric?)
> zsh: 2760 segmentation fault  guile

Thanks.

> I haven't checked if this bug is still present in cvs HEAD.

Marius made a change that squashes it.

> Patch attached.

I'll bring across what's in the head, which is to have SCM_MAKE_CHAR
cast to an unsigned char, instead of demanding that from all callers.


[-- Attachment #2: chars.h.unsigned.diff --]
[-- Type: text/plain, Size: 406 bytes --]

--- chars.h.~1.11.4.4.~	2004-04-25 09:25:32.000000000 +1000
+++ chars.h	2005-03-26 07:36:06.574079280 +1100
@@ -51,7 +51,7 @@
  */
 #define SCM_CHARP(x) (SCM_ITAG8(x) == scm_tc8_char)
 #define SCM_CHAR(x) ((unsigned int)SCM_ITAG8_DATA(x))
-#define SCM_MAKE_CHAR(x) SCM_MAKE_ITAG8((scm_t_bits) x, scm_tc8_char)
+#define SCM_MAKE_CHAR(x) SCM_MAKE_ITAG8((scm_t_bits) (unsigned char) (x), scm_tc8_char)
 
 \f
 

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: segfault in guile 1.6.7
  2005-03-25 20:37 ` Kevin Ryde
@ 2005-03-25 20:47   ` Kevin Ryde
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Ryde @ 2005-03-25 20:47 UTC (permalink / raw)
  Cc: guile-devel

I wrote:
>
> Marius

Actually it was Han-Wen Nienhuys.


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: segfault in guile 1.6.7
  2005-03-24 17:11 segfault in guile 1.6.7 Alexey Voinov
  2005-03-25 20:37 ` Kevin Ryde
@ 2005-05-22 18:59 ` Marius Vollmer
  2005-05-23  1:34   ` Kevin Ryde
  1 sibling, 1 reply; 7+ messages in thread
From: Marius Vollmer @ 2005-05-22 18:59 UTC (permalink / raw)
  Cc: guile-devel

Alexey Voinov <voins@voins.program.ru> writes:

> There's a bug in guile srfi-13 implementation. 

Thanks!  I applied it.

> I haven't checked if this bug is still present in cvs HEAD.

It should be fixed in CVS HEAD already.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: segfault in guile 1.6.7
  2005-05-22 18:59 ` Marius Vollmer
@ 2005-05-23  1:34   ` Kevin Ryde
  2005-06-06 19:20     ` Marius Vollmer
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Ryde @ 2005-05-23  1:34 UTC (permalink / raw)
  Cc: Alexey Voinov, guile-devel

Marius Vollmer <mvo@zagadka.de> writes:
>
> Thanks!  I applied it.

I already made a fix (from the head by Han-Wen) in chars.h which
covers this, by stopping signed values getting into the value field of
a char SCM (there's 24 or 56 bits there).  Should fix applications
passing "char" to SCM_MAKE_CHAR too.


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: segfault in guile 1.6.7
  2005-05-23  1:34   ` Kevin Ryde
@ 2005-06-06 19:20     ` Marius Vollmer
  2005-06-06 22:07       ` Kevin Ryde
  0 siblings, 1 reply; 7+ messages in thread
From: Marius Vollmer @ 2005-06-06 19:20 UTC (permalink / raw)
  Cc: guile-devel

Kevin Ryde <user42@zip.com.au> writes:

> Marius Vollmer <mvo@zagadka.de> writes:
>>
>> Thanks!  I applied it.
>
> I already made a fix (from the head by Han-Wen) in chars.h which
> covers this, by stopping signed values getting into the value field of
> a char SCM (there's 24 or 56 bits there).

Oops.  Is there any harm in having it fixed in both places?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: segfault in guile 1.6.7
  2005-06-06 19:20     ` Marius Vollmer
@ 2005-06-06 22:07       ` Kevin Ryde
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Ryde @ 2005-06-06 22:07 UTC (permalink / raw)
  Cc: Alexey Voinov, guile-devel

Marius Vollmer <mvo@zagadka.de> writes:
>
> Oops.  Is there any harm in having it fixed in both places?

Shouldn't be.


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-06 22:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-24 17:11 segfault in guile 1.6.7 Alexey Voinov
2005-03-25 20:37 ` Kevin Ryde
2005-03-25 20:47   ` Kevin Ryde
2005-05-22 18:59 ` Marius Vollmer
2005-05-23  1:34   ` Kevin Ryde
2005-06-06 19:20     ` Marius Vollmer
2005-06-06 22:07       ` Kevin Ryde

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).