GithubHelp home page GithubHelp logo

sharplispers / chipz Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 5.0 110 KB

A Common Lisp library for decompressing deflate, zlib, gzip, and bzip2 data

License: BSD 3-Clause "New" or "Revised" License

Common Lisp 100.00%

chipz's Issues

Add chipz to ultralisp

I'm not sure what the protocol is for something like this, could someone place this into ultralisp?

If it is something I can do via a mirroring fork, then I'll do it. If a sharplisper member is empowered to do so then I request that it be so.

And if there is good reason to avoid it, I'm all ears.

cheers

invalid-bzip2-data error

Hello,

i tried the following code with an error :

From linux shell :

:~> echo "huge" | bzip2 - > huge.bz2
:~> file huge.bz2
huge.bz2: bzip2 compressed data, block size = 900k

Lisp Code (according to the doc) :

(with-open-file (stream "huge.bz2"  :element-type '(unsigned-byte 8))
           (chipz:decompress nil 'chipz:bzip2 stream))

Error (SIMPLE-ERROR) during printing: #<CHIPZ:INVALID-BZIP2-DATA {1006A7BB43}>

With a little help from comp.lang.lisp, i think there is an error in the bzip2.lisp file.
In the following function :

(bzip2-selector1 (state)
               (declare (type bzip2-state state))
               (let ((n-groups (ensure-and-read-bits 3 state)))
                 (unless (<= 3 n-groups 6)
                   (error 'invalid-bzip2-data))
                 (setf (bzip2-state-n-groups state) n-groups)
(transition-to bzip2-selector2)))

the n-groups value is tested between 3 and 6.
But in the C code version (decompress.c v1.0.6) the test is between 2 and 6.
if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); (line 288)

With 2 instead of 3, no more error in the test.

Thanks

"unexpected EOF" from some salza2 deflate data

Following has a reasonable chance (30%+) of triggering EOF error from chipz:

(ql:quickload '(chipz salza2))

(let* ((d (map-into (make-array (expt 2 8) :element-type '(unsigned-byte 8))
                    (lambda () (random 255))))
       (v (salza2:compress-data d 'salza2:deflate-compressor)))
  (with-simple-restart (continue "continue")
    (let ((x (time (chipz:decompress nil 'chipz:deflate v))))
      (assert (equalp d x)))))

Not completely sure it is chipz rather than salza2, but other decompressors don't seem to object to the same data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.