GNU bug report logs - #29162
[PATCH] fix scm_make_foreign_object_n

Previous Next

Package: guile;

Reported by: Sergei Trofimovich <slyfox <at> gentoo.org>

Date: Sun, 5 Nov 2017 22:16:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: ludo <at> gnu.org (Ludovic Courtès)
To: Sergei Trofimovich <slyfox <at> gentoo.org>
Cc: 29162 <at> debbugs.gnu.org
Subject: bug#29162: [PATCH] fix scm_make_foreign_object_n
Date: Wed, 22 Nov 2017 16:12:24 +0100
Hi Sergei,

Sergei Trofimovich <slyfox <at> gentoo.org> skribis:

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

Your analysis seems right, but the code in the current ‘stable-2.2’
branch (which corresponds to the 2.2.x stable series) has different code
(correct code):

  SCM_VALIDATE_VTABLE (SCM_ARG1, type);

  layout = SCM_VTABLE_LAYOUT (type);

  if (scm_i_symbol_length (layout) / 2 < n)
    scm_out_of_range (FUNC_NAME, scm_from_size_t (n));

What version were you looking at?

Thanks,
Ludo’.




This bug report was last modified 1 year and 288 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.