From 5619f4cd2ca3108c8dea17ba656b5ce44a60ca29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 11 Jan 2019 19:42:40 +0400 Subject: [PATCH] Revert "decomp: fix gcc warning strict-overflow" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The warning doesn't happen with current build-sys. The overlapping behaviour is undefined with memcpy. memmove doesn't have the same semantic either than the loop. Let's revert! Fixes: https://gitlab.gnome.org/GNOME/gcab/issues/12 This reverts commit e48074952743f53d8ac529d4debc421e7e0f6937. Signed-off-by: Marc-André Lureau --- libgcab/decomp.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libgcab/decomp.c b/libgcab/decomp.c index 64d97f8..0c2b184 100644 --- a/libgcab/decomp.c +++ b/libgcab/decomp.c @@ -1015,9 +1015,7 @@ int LZXfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) { window_posn += match_length; /* copy match data - no worries about destination wraps */ - memcpy(rundest, runsrc, match_length); - rundest += match_length; - runsrc += match_length; + while (match_length-- > 0) *rundest++ = *runsrc++; } } break; @@ -1106,9 +1104,7 @@ int LZXfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) { window_posn += match_length; /* copy match data - no worries about destination wraps */ - memcpy(rundest, runsrc, match_length); - rundest += match_length; - runsrc += match_length; + while (match_length-- > 0) *rundest++ = *runsrc++; } } break; -- 2.20.1.98.gecbdaf0899