|Subject:||Another COW violation|
IO-Compress’s t/109merge-rawdeflate.t fails for me when I compile bleadperl with -Accflags=-DPERL_DEBUG_READONLY_COW. Why this failure was not happening before I don’t know. (Presumably it is now getting a COW scalar where it wasn’t getting one before.) The attached diff fixes the problem. I don’t know how to write a test that fails under a perl that has cow-debugging disabled. I assume that Compress::Raw::Bzip2 will need a similar patch.
diff --git a/Zlib.xs b/Zlib.xs index 46d4af3..aaf8457 100644 --- a/Zlib.xs +++ b/Zlib.xs @@ -1755,7 +1755,7 @@ scan(s, buf, out=NULL, eof=FALSE) croak("Wide character in Compress::Raw::Zlib::InflateScan::scan input parameter"); #endif /* initialise the input buffer */ - s->stream.next_in = (Bytef*)SvPV_nomg_nolen(buf) ; + s->stream.next_in = (Bytef*)SvPV_force_nomg_nolen(buf) ; s->stream.avail_in = SvCUR(buf) ; start_len = s->stream.avail_in ; s->bytesInflated = 0 ;