Subject: bug#29162: [PATCH] fix scm_make_foreign_object_n

From: Sergei Trofimovich <[email-masked]>
Date: Wed, 22 Nov 2017 20:03:20 +0000

On Wed, 22 Nov 2017 16:12:24 +0100
[email-masked] (Ludovic Courtès) wrote:

> Hi Sergei,
> 
> Sergei Trofimovich <[email-masked]> 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?

It was the master branch of
    git://git.savannah.gnu.org/guile.git

Commit from November:
    http://git.savannah.gnu.org/cgit/guile.git/commit/?id=f96a670332b224326b89ce135a0edfb77a70c46e    

The link with line number:
    http://git.savannah.gnu.org/cgit/guile.git/tree/libguile/foreign-object.c?id=f96a670332b224326b89ce135a0edfb77a70c46e#n111

In master branch it still seems to be around:
    http://git.savannah.gnu.org/cgit/guile.git/tree/libguile/foreign-object.c#n111

-- 

  Sergei