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.9-72-g088cfb


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-72-g088cfb7
Date: Sat, 17 Aug 2013 03:05:15 +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=088cfb7d761b01a2620d78f10e8dbcaa07485a32

The branch, stable-2.0 has been updated
       via  088cfb7d761b01a2620d78f10e8dbcaa07485a32 (commit)
      from  8d5d0425ce10dcf035fbf717852938291261bd7e (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 088cfb7d761b01a2620d78f10e8dbcaa07485a32
Author: Mark H Weaver <address@hidden>
Date:   Fri Aug 16 22:54:39 2013 -0400

    Improved error checking in bytevector->uint-list and bytevector->sint-list.
    
    Partially fixes <http://bugs.gnu.org/15100>.
    Reported by Göran Weinholt <address@hidden>.
    
    * libguile/bytevectors.c (INTEGERS_TO_LIST): Make sure SIZE isn't 0.
      Allow SIZE to be greater than the bytevector length, for consistency
      with allowing extra bytes at the end when the bytevector length is
      non-zero.  Use scm_from_size_t instead of scm_from_uint.
    
    * test-suite/tests/bytevectors.test: Add tests.  Remove a test that
      checks for an exception when SIZE is greater than the bytevector
      length.

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

Summary of changes:
 libguile/bytevectors.c            |    8 +++-----
 test-suite/tests/bytevectors.test |   10 +++++++++-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index cf41f2f..be8b654 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -1099,20 +1099,18 @@ SCM_DEFINE (scm_bytevector_sint_set_x, 
"bytevector-sint-set!", 5, 0, 0,
                                                                        \
   SCM_VALIDATE_BYTEVECTOR (1, bv);                                     \
   SCM_VALIDATE_SYMBOL (2, endianness);                                 \
-  c_size = scm_to_uint (size);                                         \
+  c_size = scm_to_unsigned_integer (size, 1, (size_t) -1);             \
                                                                        \
   c_len = SCM_BYTEVECTOR_LENGTH (bv);                                  \
-  if (SCM_UNLIKELY (c_len == 0))                                       \
+  if (SCM_UNLIKELY (c_len < c_size))                                   \
     lst = SCM_EOL;                                                     \
-  else if (SCM_UNLIKELY (c_len < c_size))                              \
-    scm_out_of_range (FUNC_NAME, size);                                        
\
   else                                                                 \
     {                                                                  \
       const char *c_bv;                                                        
\
                                                                        \
       c_bv = (char *) SCM_BYTEVECTOR_CONTENTS (bv);                    \
                                                                        \
-      lst = scm_make_list (scm_from_uint (c_len / c_size),             \
+      lst = scm_make_list (scm_from_size_t (c_len / c_size),           \
                           SCM_UNSPECIFIED);                            \
       for (i = 0, pair = lst;                                          \
           i <= c_len - c_size;                                         \
diff --git a/test-suite/tests/bytevectors.test 
b/test-suite/tests/bytevectors.test
index 67fc680..524ce86 100644
--- a/test-suite/tests/bytevectors.test
+++ b/test-suite/tests/bytevectors.test
@@ -155,9 +155,17 @@
     (let ((b (make-bytevector 0)))
       (null? (bytevector->uint-list b (endianness big) 2))))
 
+  (pass-if "bytevector->sint-list [length < word size]"
+    (let ((b (make-bytevector 1)))
+      (null? (bytevector->sint-list b (endianness big) 2))))
+
   (pass-if-exception "bytevector->sint-list [out-of-range]"
     exception:out-of-range
-    (bytevector->sint-list (make-bytevector 6) (endianness little) 8))
+    (bytevector->sint-list (make-bytevector 6) (endianness little) -1))
+
+  (pass-if-exception "bytevector->uint-list [out-of-range]"
+    exception:out-of-range
+    (bytevector->uint-list (make-bytevector 6) (endianness little) 0))
 
   (pass-if "bytevector->sint-list [off-by-one]"
     (equal? (bytevector->sint-list (make-bytevector 31 #xff)


hooks/post-receive
-- 
GNU Guile



reply via email to

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