io_buffer.c: Allow copies between overlapping buffers with #copy and #set_string (#11640)
The current implementation of IO::Buffer#copy and #set_string has an undefined behavior when the source and destination memory overlaps, due to the underlying use of the memcpy C function.
This patch guarantees the methods to be safe even when copying between overlapping buffers by replacing memcpy with memmove,
io_buffer.c: Allow copies between overlapping buffers with #copy and #set_string (#11640)
The current implementation of
IO::Buffer#copyand#set_stringhasan undefined behavior when the source and destination memory overlaps,
due to the underlying use of the
memcpyC function.This patch guarantees the methods to be safe even when copying between
overlapping buffers by replacing
memcpywithmemmove,Fixes: [Bug #20745]