1. 8

  2. 8


    • memcpy and memmove are c functions to copy memory regions. rep movsb is an x86 instruction to copy memory regions

    • memcpy’s behaviour on overlap is undefined

    • rep movsb’s behaviour on overlap is simple and well-defined, and will maybe stomp on data depending on the direction flag and the nature of the overlap

    • memmove’s behaviour on overlap is well-defined, and will never stomp on data

    • there was a disassembler which translated rep movsb to memcpy. This was not strictly correct (though likely to be an accurate translation in most cases). Translating rep movsb to memmove would also be incorrect.

    1. 1