https://bugs.winehq.org/show_bug.cgi?id=38558
--- Comment #10 from katsunori.kumatani@gmail.com --- Nevermind the check above: it doesn't handle some corner cases I messed around with. A proper one would be something like:
if((UINT_PTR)(src - (unsigned char*)dst) < dstlen * sizeof(*dst))
This handles all cases where dst is "behind" src and touches src at a point (within dstlen), again relying on 2's complement to have efficient check (only one branch) in case performance is a worry for small strings.
It doesn't handle cases where they still overlap but with dst "in front" of src, but in those cases, I don't think the fast path corrupts anything more than doing it 1 byte at a time... so we can omit that case, but maybe I'm wrong?