This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make PerlIO::encoding even more resilient to moving buffers
authorFather Chrysostomos <sprout@cpan.org>
Mon, 15 Oct 2012 06:09:56 +0000 (23:09 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 15 Oct 2012 14:54:20 +0000 (07:54 -0700)
commite9a8753af0f0f92b6ebd38e85f4b6a815f978eed
tree41ae090a558a58a3eefec5e5d4efd98b9073fc33
parent42037ad6a00723dfac1ddfb747c39cf563f1fab4
Make PerlIO::encoding even more resilient to moving buffers

Commit 667763bdbf was not good enough.

If the buffer passed to an encode method is reallocated, it may be
smaller than the size (bufsiz) stored inside the encoding layer.  So
we need to extend the buffer in that case and make sure the buffer
pointer is not pointing to freed memory.

The test as modified by this commit causes malloc errors on stderr
when I try it without the encoding.xs changes.
ext/PerlIO-encoding/encoding.xs
ext/PerlIO-encoding/t/encoding.t