cy99 / fastlz Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/fastlz
License: Other
Automatically exported from code.google.com/p/fastlz
License: Other
FastLZ - lightning-fast lossless compression library Author: Ariya Hidayat Official website: http://www.fastlz.org FastLZ is distributed using the MIT license, see file LICENSE for details. FastLZ consists of two files: fastlz.h and fastlz.c. Just add these files to your project in order to use FastLZ. For information on compression and decompression routines, see fastlz.h. A simple file compressor called 6pack is included as an example on how to use FastLZ. The corresponding decompressor is 6unpack. To compile using GCC: gcc -o 6pack 6pack.c fastlz.c gcc -o 6unpack 6unpack.c fastlz.c To compile using MinGW: mingw32-gcc -o 6pack 6pack.c fastlz.c mingw32-gcc -o 6unpack 6unpack.c fastlz.c To compile using Microsoft Visual C++: cl 6pack.c fastlz.c cl 6unpack.c fastlz.c To compile using Borland C++: bcc32 6pack.c fastlz.c bcc32 6unpack.c fastlz.c To compile using OpenWatcom C/C++: cl386 6pack.c fastlz.c cl386 6unpack.c fastlz.c To compile using Intel C++ compiler for Windows: icl 6pack.c fastlz.c icl 6unpack.c fastlz.c To compile using Intel C++ compiler for Linux: icc -o 6pack 6pack.c fastlz.c icc -o 6unpack 6unpack.c fastlz.c To compile 6pack using LCC-Win32: lc 6pack.c fastlz.c lc 6unpack.c fastlz.c To compile 6pack using Pelles C: pocc 6pack.c pocc 6unpack.c pocc fastlz.c polink 6pack.obj fastlz.obj polink 6unpack.obj fastlz.obj For speed optimization, always use proper compile flags for optimization options. Typical compiler flags are given below: * GCC (pre 4.2): -march=pentium -O3 -fomit-frame-pointer -mtune=pentium * GCC 4.2 or later: -march=pentium -O3 -fomit-frame-pointer -mtune=generic * Digital Mars C/C++: -o+all -5 * Intel C++ (Windows): /O3 /Qipo * Intel C++ (Linux): -O2 -march=pentium -mtune=pentium * Borland C++: -O2 -5 * LCC-Win32: -O * Pelles C: /O2
Got misaligned data access at this line in FASTLZ_DECOMPRESSOR:
*q++ = *p++;
I replaced all of
/* copy a byte, so that now it's word aligned */
if(len & 1)
{
*op++ = *ref++;
len--;
}
/* copy 16-bit at once */
q = (flzuint16*) op;
op += len;
p = (const flzuint16*) ref;
for(len>>=1; len > 4; len-=4)
{
*q++ = *p++;
*q++ = *p++;
*q++ = *p++;
*q++ = *p++;
}
for(; len; --len)
*q++ = *p++;
with
while(len--) *op++= *ref++;
and now it works fine (and fast I think).
Original issue reported on code.google.com by [email protected]
on 16 Jun 2007 at 2:57
On a sun4u machine compile with gcc version 4
sunw389:fastlz>gcc 6pack.c fastlz.c -o 6pack -g
sunw389:fastlz>gdb 6pack
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.8"...
(gdb) run 6pack 6pack.6p
Program received signal SIGSEGV, Segmentation fault.
0x000120d0 in fastlz2_compress (input=0xffbdec10, length=34332,
output=0xffb9ec10) at fastlz.c:199
199 HASH_FUNCTION(hval,ip);
(gdb)
Using Sun studio 11 cc without -fast option works.
Original issue reported on code.google.com by [email protected]
on 15 Jun 2007 at 4:02
On sunsparc64 machine, the function fastlz2_compress() for FastLZ level 2
results in SEGV while accessing invalid memory pointed by ip in
HASH_FUNCTION at line 376.
This happens only when the input data pattern encounters 5-byte match as
given below and distance is greater than 1 indicating it's not a run. The
for loop given below makes an assumption that the ip_limit condition
restricts ip to be atleast 8 less than ip_bound value. But when we find
5-byte match, the ip value may exceed ip_bound value. This results in
accessing invalid memory within HASH_FUNCTION.
Original issue reported on code.google.com by [email protected]
on 2 Feb 2010 at 10:30
Hi,
The following program makes FastLZ read past the end of its input, possibly
causing a crash:
#include <string.h>
#include <stdlib.h>
#include "fastlz.h"
int main(int argc, char** argv)
{
char out[4096];
char *in = (char *)malloc(6);
in[0] = 0x23;
in[1] = 0x00;
in[2] = 0x00;
in[3] = 0x00;
in[4] = 0x00;
in[5] = 0x40;
return fastlz_decompress(in, 6, out, 4096);
}
You can verify the read-past-end behavior with Valgrind or similar.
Original issue reported on code.google.com by [email protected]
on 1 Mar 2012 at 6:17
It would be nice if fastlz had 64-bit support. Simply switch all those cursed
int's to uint64's.
OR, just add 32-bit -AND- 64-bit support via pre-processor options!
Original issue reported on code.google.com by [email protected]
on 14 Nov 2010 at 7:17
http://fastlz.org/download.htm
the link to this:
https://code.google.com/p/fastlz/downloads/list
seems off/wrong
Original issue reported on code.google.com by rogerpack2005
on 19 Nov 2013 at 8:56
What steps will reproduce the problem?
1. Compile the code with high warning level.
Those warnings could be avoided by using the proper casts
*op = static_cast<flzuint8>(..)
Thank you.
Original issue reported on code.google.com by [email protected]
on 13 Jul 2011 at 1:42
I am getting the following warnings:
1>fastlz.c(234) : warning C4244: '=' : conversion from '__int64' to
'flzuint32', possible loss of data
1>fastlz.c(304) : warning C4244: '=' : conversion from '__int64' to
'flzuint32', possible loss of data
1>fastlz.c(417) : warning C4244: 'return' : conversion from '__int64' to
'int', possible loss of data
1>fastlz.c(548) : warning C4244: 'return' : conversion from '__int64' to
'int', possible loss of data
1>fastlz.c(234) : warning C4244: '=' : conversion from '__int64' to
'flzuint32', possible loss of data
1>fastlz.c(304) : warning C4244: '=' : conversion from '__int64' to
'flzuint32', possible loss of data
1>fastlz.c(417) : warning C4244: 'return' : conversion from '__int64' to
'int', possible loss of data
1>fastlz.c(548) : warning C4244: 'return' : conversion from '__int64' to
'int', possible loss of data
It would be nice if these warnings could be tidied up by casting the
datatypes as necessary.
- Simon.
Original issue reported on code.google.com by [email protected]
on 27 Apr 2009 at 10:23
What steps will reproduce the problem?
1. Call compress with 64K chunks.
2. Running on a 64bit machine.
What is the expected output? What do you see instead?
hslot is NULL I get a segfault on the *hslot=ip line.
What version of the product are you using? On what operating system?
latest trunk
Original issue reported on code.google.com by [email protected]
on 22 Jan 2010 at 10:48
On a sun4u machine compile with gcc version 4
sunw389:fastlz>gcc 6pack.c fastlz.c -o 6pack -g
sunw389:fastlz>gdb 6pack
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.8"...
(gdb) run 6pack 6pack.6p
Program received signal SIGSEGV, Segmentation fault.
0x000120d0 in fastlz2_compress (input=0xffbdec10, length=34332,
output=0xffb9ec10) at fastlz.c:199
199 HASH_FUNCTION(hval,ip);
(gdb)
Using Sun studio 11 cc without -fast option works.
Original issue reported on code.google.com by [email protected]
on 15 Jun 2007 at 4:00
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.