Fix LZX decompression corruption regression

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2019-01-11 19:51:44 +04:00
parent 295ebd42ae
commit d29dd47f96
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From 5619f4cd2ca3108c8dea17ba656b5ce44a60ca29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
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 <marcandre.lureau@redhat.com>
---
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

View File

@ -1,6 +1,6 @@
Name: gcab
Version: 1.1
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Cabinet file library and tool
License: LGPLv2+
@ -8,6 +8,7 @@ License: LGPLv2+
URL: http://ftp.gnome.org/pub/GNOME/sources/gcab
Source0: http://ftp.gnome.org/pub/GNOME/sources/gcab/%{version}/%{name}-%{version}.tar.xz
Patch1: 0001-gcab-Fix-regression-from-commit-a15d91073fd5d6be25.patch
Patch2: 0002-Revert-decomp-fix-gcc-warning-strict-overflow.patch
BuildRequires: git-core
BuildRequires: gettext
@ -78,6 +79,9 @@ Libraries, includes, etc. to compile with the gcab library.
%{_libdir}/pkgconfig/libgcab-1.0.pc
%changelog
* Fri Jan 11 2019 Marc-André Lureau <marcandre.lureau@redhat.com> - 1.1-4
- Fix LZX decompression corruption regression.
* Thu Aug 2 2018 Marc-André Lureau <marcandre.lureau@redhat.com> - 1.1-3
- fix 'rewind' regression rhbz#1608301