bug-texinfo
[Top][All Lists]
Advanced

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

Re: Texinfo 6.7 released


From: Eli Zaretskii
Subject: Re: Texinfo 6.7 released
Date: Sat, 28 Sep 2019 11:00:21 +0300

> From: Gavin Smith <address@hidden>
> Date: Fri, 27 Sep 2019 20:23:33 +0100
> Cc: Texinfo <address@hidden>
> 
> This problem occurred before and at that time, we solved it by
> avoiding using "free" altogether (commit d9fd777).

Maybe that's what we should do here as well.  'free' is a macro
expanded into something implemented inside Perl, right?  And asprintf
comes from Gnulib on MS-Windows, right?  So we have that problem I
mentioned with allocation and free that come from different libraries.

> > The output is below.  Does it help?
> 
> It shows it is likely the "init" function in parsetexi/api.c where the
> problem occurs. Maybe you could try a change like the one attached and
> see exactly where the problem is occurring.

I needed to add dTHX to 'init', or it wouldn't compile.  After that,
the output is:

  rm -rf $backupdir; exit $rc
  A 1
  A 2
  A 3
  B 1
  B 2
  B 3
  B 7
  B 8
  Free to wrong pool 3f5d48 not 40f018e at ..\tp/Texinfo/XSLoader.pm line 224, 
<$fh> line 8.

So it looks like it indeed crashes when calling 'free' on storage
allocated by asprintf.  With that in mind, I modified api.c as below:

--- ./tp/Texinfo/XS/parsetexi/api.c.~1~ 2019-08-25 20:11:45.000000000 +0300
+++ ./tp/Texinfo/XS/parsetexi/api.c     2019-09-28 10:50:13.319625000 +0300
@@ -56,7 +56,8 @@ find_locales_dir (char *builddir)
 
   dTHX;
 
-  asprintf (&s, "%s/LocaleData", builddir);
+  s = malloc (strlen (builddir) + strlen ("/LocaleData") + 1);
+  sprintf (s, "%s/LocaleData", builddir);
   dir = opendir (s);
   if (!dir)
     {


and the problem went away.  If this is the right fix, then I think we
cannot use Gnulib's asprintf in Parsetexi, and there are a couple of
other places with the same problem, which we need to fix as well,
right?

Thanks.



reply via email to

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