On Mon, Jan 13, 2025 at 02:52:48PM +0900, SASANO Takayoshi wrote:
> Hi,
> 
> > As I mentioned:
> > 
> >>> The check in explode.c seems correct since it doesn't have this cast.
> 
> I didn't say about cast.

But I did...

> My issue is OpenBSD's memcpy() cannot handle overlapped area
> and memcpy() within #ifndef NOMEMCPY / #endif should be replaced with
> memmove(). Otherwise use NOMEMCPY --- I choose this because it can be fix
> both inflate.c and explode.c
> 
> Your diff looks only the fix of inflate.c.
> Does explode.c not replace with memmove()? That's my question.

You're right It actually does need it. The types involved are unsigned
in both files (the cast made me think they weren't) so the overlap check
is incorrect in both. Wonderful.

What worries me a bit is that the NOMEMCPY path uses this:

            do {
              redirSlide[w++] = redirSlide[d++];
            } while (--e);

which isn't handling overlaps the way memmove does if w > d but w - d < e.

Manifestly the CRC checks in your example file expect this behavior.

Reply via email to