[PATCH 4/5] include: Add wmemmove to wchar.h
Dmitry Timoshkov
dmitry at baikal.ru
Sun May 27 23:22:22 CDT 2018
Alex Henrie <alexhenrie24 at gmail.com> wrote:
> > > +static inline wchar_t* __cdecl wmemmove(wchar_t *dst, const wchar_t
> *src, size_t n)
> > > +{
> > > + size_t i;
> > > + if (dst <= src) return wmemcpy(dst, src, n);
> > > + for (i = 1; i <= n; i++)
> > > + dst[n - i] = src[n - i];
> > > + return dst;
> > > +}
>
> > The optimization with wmemcpy() looks arbitrary and not safe.
>
> It looks perfectly safe to me. Can you give an example of valid inputs that
> would cause memory corruption?
When the buffers overlap each other with 1 byte offset.
--
Dmitry.
More information about the wine-devel
mailing list