Bug#389571: libvorbis-perl: 'make test' failure: double free or coruption

Niko Tyni ntyni at iki.fi
Tue Sep 26 18:25:33 UTC 2006


tags 389571 patch
thanks

On Tue, Sep 26, 2006 at 04:54:33PM +0300, Niko Tyni wrote:
> Package: libvorbis-perl

> *** glibc detected *** double free or corruption (!prev): 0x0816ab78 ***
> make: *** [test_dynamic] Aborted

> Perl doesn't know that ov_clear() has closed the file, and when it
> tries to close it (explicitly via close() or implicitly at the end of
> the program), the result is a double free.

OK, the attached patch seems to help. It dups the filehandle before
passing it to ov_open(). This way libvorbisfile can do what it wants
with the resulting handle, and Perl gets to keep its own.

Cheers,
-- 
Niko Tyni	ntyni at iki.fi
-------------- next part --------------
--- libvorbis-perl-0.05/Vorbis.xs	2003-08-13 17:16:29.000000000 +0300
+++ libvorbis-perl-0.05-fixed/Vorbis.xs	2006-09-26 21:24:11.000000000 +0300
@@ -62,8 +62,13 @@
         char *initial
         long ibytes
         CODE:
+	FILE *dupfile;
+	/* dup the file so that ov_clear() can close it behind 
+	   Perl's back (Debian bug #389571) */ 
+	dupfile = fdopen(dup(fileno(file)), "r");
+
         /* we swapped file and self for an OO interface */
-        RETVAL = ov_open(file, self, initial, ibytes);
+        RETVAL = ov_open(dupfile, self, initial, ibytes);
         OUTPUT:
         RETVAL
 


More information about the pkg-perl-maintainers mailing list