guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-112-g589bc


From: Andreas Rottmann
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-112-g589bc52
Date: Thu, 09 Jun 2011 20:11:23 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=589bc528bd63291d2faa4bbcef9e402e62e1f72d

The branch, stable-2.0 has been updated
       via  589bc528bd63291d2faa4bbcef9e402e62e1f72d (commit)
      from  e108c961fed2ffdedddcd10bad9c6aae44491b1e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 589bc528bd63291d2faa4bbcef9e402e62e1f72d
Author: Andreas Rottmann <address@hidden>
Date:   Thu Jun 9 22:11:02 2011 +0200

    Fix likely crash in `stable-sort!'
    
    * libguile/sort.c (scm_stable_sort_x): Properly handle zero-length
      vectors.
    * test-suite/tests/sort.test ("stable-sort"): Add test for this case.

-----------------------------------------------------------------------

Summary of changes:
 libguile/sort.c            |    7 ++++++-
 test-suite/tests/sort.test |    9 +++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libguile/sort.c b/libguile/sort.c
index 5fdbb17..ecadd82 100644
--- a/libguile/sort.c
+++ b/libguile/sort.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,2001,2002, 2004, 2006, 2007, 2008, 2009, 2010 Free 
Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2001,2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011 
Free Software Foundation, Inc.
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * as published by the Free Software Foundation; either version 3 of
@@ -495,6 +495,11 @@ SCM_DEFINE (scm_stable_sort_x, "stable-sort!", 2, 0, 0,
       
       vec_elts = scm_vector_writable_elements (items, &vec_handle,
                                               &len, &inc);
+      if (len == 0) {
+        scm_array_handle_release (&vec_handle);
+        return items;
+      }
+      
       temp = scm_c_make_vector (len, SCM_UNDEFINED);
       temp_elts = scm_vector_writable_elements (temp, &temp_handle,
                                                NULL, NULL);
diff --git a/test-suite/tests/sort.test b/test-suite/tests/sort.test
index 4223b92..9209b53 100644
--- a/test-suite/tests/sort.test
+++ b/test-suite/tests/sort.test
@@ -1,5 +1,5 @@
 ;;;; sort.test --- tests Guile's sort functions    -*- scheme -*-
-;;;; Copyright (C) 2003, 2006, 2007, 2009 Free Software Foundation, Inc.
+;;;; Copyright (C) 2003, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
 ;;;; 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -73,5 +73,10 @@
   ;; in guile 1.8.0 and 1.8.1 this test failed, an empty list provoked a
   ;; wrong-type-arg exception (where it shouldn't)
   (pass-if "empty list"
-    (eq? '() (stable-sort '() <))))
+    (eq? '() (stable-sort '() <)))
+
+  ;; Ditto here, but up to 2.0.1 and 2.1.0 and invoking undefined
+  ;; behavior (integer underflow) leading to crashes.
+  (pass-if "empty vector"
+    (equal? '#() (stable-sort '#() <))))
 


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]