Project

General

Profile

« Previous | Next » 

Revision 35bf6603

Added by hanazuki (Kasumi Hanazuki) about 1 year ago

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,

Fixes: [Bug #20745]