Code Monkey home page Code Monkey logo

Comments (2)

3b avatar 3b commented on July 1, 2024

smaller/non-random version

(let* ((d (coerce #(161 16 164 216 206 26 13 97 172 65 152 52 116 77 19 10) '(simple-array (unsigned-byte 8) 1)))
       (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)))))

from chipz.

se-mz avatar se-mz commented on July 1, 2024

This is an issue with chipz. decode-value ensures as many bits as are needed for the longest code, which can read bits past the end of the input if the code for the end-of-block marker isn't at least as long as all other codes. An encoder will usually not produce such a tree since EOB is by definition the least frequently used symbol - except when the last block uses the fixed Huffman code. Of course, a stupid/malicious encoder could also trigger this in a dynamic block.

Since this issue only affects the rare raw Deflate (zlib & gzip have trailing checksums that end up protecting against this) and repeatedly calling ensure-bits in the hottest part of the code is probably a bad idea, it might be worth it to write a separate version of decode-value for raw Deflate.

from chipz.

Related Issues (3)

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.