ghedo/p5-FFI-Raw — pull request #18 by klaus (2014-01-15 15:03:31+00:00)
Title: MemPtr::tostr() newSVpvn() instead of newSVpm()

Hi ghedo!

Thank You for creating FFI::Raw! It is excellent work that we want to depend on with our modules.

Unfortunately we have discovered a Problem in ::MemPtr::tostr():

FFI::Raw::MemPtr::tostr() should use newSVpvn(), not newSVpv(), when a length
argument is supplied. Otherwise a length argument of 0 is treated by newSVpv()
as an instruction to use strlen() to find the length, not as a length of 0.

You can see another actual 'live' Problem of the newSVpv() call in this test https://github.com/klaus/zmq-ffi/blob/e9414a2e9fe9320ce4fb758b830b1faf2aa43444/t/router-req.t of the ZMQ::FFI module that depends on FFI::Raw.

Please consider applying this patch!

Thank You,

klaus