bug-guile
[Top][All Lists]
Advanced

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

bug#29162: [PATCH] fix scm_make_foreign_object_n


From: Sergei Trofimovich
Subject: bug#29162: [PATCH] fix scm_make_foreign_object_n
Date: Sun, 5 Nov 2017 22:15:10 +0000

Noticed the error when ran test suite on ia64
but failure is not specific to t. x86_64 is as broken.

test-foreign-object-c fails as:

```
Backtrace:
           0 (apply-smob/1 #<catch-closure 556d010a52a0>)

ERROR: In procedure apply-smob/1:
ERROR: In procedure make-foreign-object: Value out of range: 2
FAIL: test-foreign-object-c
```

The cause of the failure is wrong check for amount of available
slots prepared by 'scm_make_foreign_object_type'.

The fix is easy: check for amount of slots available.

* libguile/foreign-object.c(scm_make_foreign_object_n): fix slot
  count check in foreign object constructors.

Signed-off-by: Sergei Trofimovich <address@hidden>
---
 libguile/foreign-object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libguile/foreign-object.c b/libguile/foreign-object.c
index 34b9f22ca..8fd2c384c 100644
--- a/libguile/foreign-object.c
+++ b/libguile/foreign-object.c
@@ -108,7 +108,7 @@ scm_make_foreign_object_n (SCM type, size_t n, void *vals[])
 
   SCM_VALIDATE_VTABLE (SCM_ARG1, type);
 
-  if (SCM_VTABLE_SIZE (type) / 2 < n)
+  if (SCM_VTABLE_SIZE (type) < n)
     scm_out_of_range (FUNC_NAME, scm_from_size_t (n));
 
   for (i = 0; i < n; i++)
-- 
2.15.0






reply via email to

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