diff options
author | Yann Collet <cyan@fb.com> | 2016-11-17 21:02:06 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2016-11-17 21:02:06 (GMT) |
commit | 1abecbc33c8ec5b84d2623dcbe73136aeb99db37 (patch) | |
tree | 398361394772160cd31cbc2b496d4814484fcb10 /lib | |
parent | 7fde7438d39f8452f89e3fee5ba4a16c502dffb0 (diff) | |
download | lz4-1abecbc33c8ec5b84d2623dcbe73136aeb99db37.zip lz4-1abecbc33c8ec5b84d2623dcbe73136aeb99db37.tar.gz lz4-1abecbc33c8ec5b84d2623dcbe73136aeb99db37.tar.bz2 |
fix 32-bits mode.
Large File support for Mac OS-X in 32-bits mode
Fixed potential undefined behavior
Changed makefile for 32-bits mode
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 10 | ||||
-rw-r--r-- | lib/lz4.c | 8 | ||||
-rw-r--r-- | lib/lz4.h | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/lib/Makefile b/lib/Makefile index 4c9b929..216d136 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -70,12 +70,18 @@ else SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER) endif -default: lib +default: lib-release all: lib +all32: CFLAGS+=-m32 +all32: all + lib: liblz4.a liblz4 +lib-release: CFLAGS := -O3 +lib-release: lib + liblz4.a: *.c ifeq ($(BUILD_STATIC),yes) @echo compiling static library @@ -96,7 +102,7 @@ else endif clean: - @$(RM) -f core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* liblz4.pc dll/liblz4.dll dll/liblz4.lib + @$(RM) core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* liblz4.pc dll/liblz4.dll dll/liblz4.lib @echo Cleaning library completed @@ -141,12 +141,14 @@ typedef uint32_t U32; typedef int32_t S32; typedef uint64_t U64; + typedef uintptr_t uptrval; #else typedef unsigned char BYTE; typedef unsigned short U16; typedef unsigned int U32; typedef signed int S32; typedef unsigned long long U64; + typedef size_t uptrval; /* generally true, except OpenVMS-64 */ #endif @@ -1139,8 +1141,8 @@ FORCE_INLINE int LZ4_decompress_generic( s = *ip++; length += s; } while ( likely(endOnInput ? ip<iend-RUN_MASK : 1) & (s==255) ); - if ((safeDecode) && unlikely((size_t)(op+length)<(size_t)(op))) goto _output_error; /* overflow detection */ - if ((safeDecode) && unlikely((size_t)(ip+length)<(size_t)(ip))) goto _output_error; /* overflow detection */ + if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)(op))) goto _output_error; /* overflow detection */ + if ((safeDecode) && unlikely((uptrval)(ip)+length<(uptrval)(ip))) goto _output_error; /* overflow detection */ } /* copy literals */ @@ -1178,7 +1180,7 @@ FORCE_INLINE int LZ4_decompress_generic( if ((endOnInput) && (ip > iend-LASTLITERALS)) goto _output_error; length += s; } while (s==255); - if ((safeDecode) && unlikely((size_t)(op+length)<(size_t)op)) goto _output_error; /* overflow detection */ + if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error; /* overflow detection */ } length += MINMATCH; @@ -85,7 +85,7 @@ extern "C" { /*========== Version =========== */ #define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ #define LZ4_VERSION_MINOR 7 /* for new (non-breaking) interface capabilities */ -#define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */ +#define LZ4_VERSION_RELEASE 4 /* for tweaks, bug-fixes, or development */ #define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) |