On Wed, 06 Mar 2013 18:53:18 +0200, Niko Tyni wrote:

> > As discussed in <https://github.com/dankogai/p5-encode/issues/8>
> > this leaks memory:
> > 
> >  perl -MEncode=decode -E 'eval { decode("UTF-8", "\x89", 1) } while 1'
> > 
> > Fixed in Encode-2.49 and a candidate for perl-5.14.4.
> > 
> >  http://search.cpan.org/diff?from=Encode-2.48&to=Encode-2.49 
> >  http://www.nntp.perl.org/group/perl.perl5.porters/2013/03/msg199816.html
> 
> Cloning to the separate libencode-perl package.
> 
> @pkg-perl: please notify the perl bug (#702416) if/when libencode-perl
> is fixed so we can get the Breaks: version right.

2.49-1 uploaded to unstable, and a wheezy branch with 2.44-1+deb7u1
with the isolated patch created in git.

I'm attaching the diff of the potential upload to t-p-u.

Niko, I assume you contact the release team for an upload of Perl;
can you ask about this upload to t-p-u too or should we handle this
separately?

Cheers,
gregor

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Neil Young: Heart of Gold
diff --git a/debian/changelog b/debian/changelog
index 35a103a..28e4ea4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libencode-perl (2.44-1+deb7u1) UNRELEASED; urgency=low
+
+  * Add patch memory_leak.patch, backported from the 2.49 release.
+    (Closes: #702444)
+
+ -- gregor herrmann <gre...@debian.org>  Wed, 06 Mar 2013 22:03:32 +0100
+
 libencode-perl (2.44-1) unstable; urgency=high
 
   * Team upload.
diff --git a/debian/patches/memory_leak.patch b/debian/patches/memory_leak.patch
new file mode 100644
index 0000000..28e975a
--- /dev/null
+++ b/debian/patches/memory_leak.patch
@@ -0,0 +1,56 @@
+Description: fix memory leak:
+ The decode and encode methods allocated a SV for the result, this SV is
+ passed to the process_utf8() function which may croak() if the CHECK flag
+ has FB_CROAK set.
+Origin: upstream, 2.49 release
+Bug: https://github.com/dankogai/p5-encode/issues/8
+Bug-Debian: http://bugs.debian.org/702444
+Author: Christian Hansen
+Reviewed-by: gregor herrmann <gre...@debian.org>
+Last-Update: 2013-03-06
+
+--- a/Encode.xs
++++ b/Encode.xs
+@@ -440,7 +440,6 @@
+     if (src == &PL_sv_undef || SvROK(src)) src = sv_2mortal(newSV(0));
+     s = (U8 *) SvPV(src, slen);
+     e = (U8 *) SvEND(src);
+-    dst = newSV(slen>0?slen:1); /* newSV() abhors 0 -- inaba */
+     check = SvROK(check_sv) ? ENCODE_PERLQQ|ENCODE_LEAVE_SRC : SvIV(check_sv);
+     /* 
+      * PerlIO check -- we assume the object is of PerlIO if renewed
+@@ -471,6 +470,7 @@
+     }
+     }
+ 
++    dst = sv_2mortal(newSV(slen>0?slen:1)); /* newSV() abhors 0 -- inaba */
+     s = process_utf8(aTHX_ dst, s, e, check_sv, 0, strict_utf8(aTHX_ obj), renewed);
+ 
+     /* Clear out translated part of source unless asked not to */
+@@ -482,7 +482,7 @@
+     SvCUR_set(src, slen);
+     }
+     SvUTF8_on(dst);
+-    ST(0) = sv_2mortal(dst);
++    ST(0) = dst;
+     XSRETURN(1);
+ }
+ 
+@@ -504,7 +504,7 @@
+     if (src == &PL_sv_undef || SvROK(src)) src = sv_2mortal(newSV(0));
+     s = (U8 *) SvPV(src, slen);
+     e = (U8 *) SvEND(src);
+-    dst = newSV(slen>0?slen:1); /* newSV() abhors 0 -- inaba */
++    dst = sv_2mortal(newSV(slen>0?slen:1)); /* newSV() abhors 0 -- inaba */
+     if (SvUTF8(src)) {
+     /* Already encoded */
+     if (strict_utf8(aTHX_ obj)) {
+@@ -543,7 +543,7 @@
+     }
+     SvPOK_only(dst);
+     SvUTF8_off(dst);
+-    ST(0) = sv_2mortal(dst);
++    ST(0) = dst;
+     XSRETURN(1);
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 5299247..0d7aa92 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 spelling.patch
+memory_leak.patch

Attachment: signature.asc
Description: Digital signature

Reply via email to