[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memcpy on overlapping memory

From: Bruno Haible
Subject: Re: memcpy on overlapping memory
Date: Sat, 20 Aug 2022 06:25:55 +0200

Mark Esler wrote:
> I believe Gnulib contains memcpy calls on overlapping memory and that
> commit 3e7178b337e3a83df9e4f36a4aef516f089e3796 was incomplete.
> Please see https://gitlab.com/gsasl/gsasl/-/issues/4 for details.

The comment from [1] is correct.

Your statement "If left_over >= 16, memcpy will overwrite the source
as it is being copied." is incorrect.

ctx->buffer and &ctx->buffer[16] differ by 16 units, each unit being
uint32_t, that is 4 bytes wide. So these pointers differ by 64 bytes.
Since left_over ≤ 64, there is no overlap.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]