Accepting request 447483 from home:marxin:branches:Base:System

Fix undefined shift behavior done in HTONL macro.

OBS-URL: https://build.opensuse.org/request/show/447483
OBS-URL: https://build.opensuse.org/package/show/Base:System/dd_rescue?expand=0&rev=30
This commit is contained in:
Kurt Garloff 2016-12-29 16:19:32 +00:00 committed by Git OBS Bridge
parent 9d4166d673
commit c8c00d0199
3 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Dec 23 09:26:20 UTC 2016 - mliska@suse.cz
- Add gcc7-fix-htonl.patch patch.
-------------------------------------------------------------------
Fri Dec 9 11:56:45 UTC 2016 - mliska@suse.cz

View File

@ -30,6 +30,8 @@ Source99: %{name}.changes
# PATCH-FIX-OPENSUSE gcc7-static-inline.patch - Add 'static' to inlined fns
Patch1: gcc7-static-inline.patch
# PATCH-FIX-OPENSUSE gcc7-fix-htonl.patch - Fix HTONL macro
Patch2: gcc7-fix-htonl.patch
BuildRequires: autoconf
BuildRequires: libattr-devel
BuildRequires: lzo-devel
@ -119,6 +121,7 @@ data to the decompressor; the plugin is still young and might expose bugs.
%prep
%setup -q
%patch1
%patch2
./autogen.sh
# Remove build time references so build-compare can do its work

14
gcc7-fix-htonl.patch Normal file
View File

@ -0,0 +1,14 @@
--- libddr_lzo.c 2015-04-15 22:44:15.000000000 +0200
+++ libddr_lzo.c 2016-12-23 10:20:40.268227806 +0100
@@ -784,7 +784,10 @@
#if __BYTE_ORDER == __BIG_ENDIAN
#define HTONL(x) x
#else
-#define HTONL(x) ((x<<24)&0xff000000) | ((x<<8)&0x00ff0000) | ((x>>8)&0x0000ff00) | ((x>>24)&0x000000ff)
+#define HTONL(n) (((((n) & 0xFF)) << 24) | \
+ ((((n) & 0xFF00)) << 8) | \
+ ((((n) & 0xFF0000)) >> 8) | \
+ ((((n) & 0xFF000000)) >> 24))
#endif
unsigned char* lzo_search_hdr(fstate_t *fst, unsigned char* bf, int *towr,