fragglet / lhasa

Free Software LHA implementation
http://fragglet.github.io/lhasa/
ISC License
80 stars 15 forks source link

Redundant buffer size in lh_new_decoder.c #36

Open el89 opened 2 years ago

el89 commented 2 years ago

I found that ringbuf is twice larger than really needed.

Say, for lh5 the dictionary size is 8KiB. Given HISTORY_BITS=14, the maximum value returned by _read_offsetcode function is 8191, thus the max offset for a copy command is 8192. However, _lh_newdecoder.c creates ringbuf of size 1<<HISTORY_BITS, that is twice larger than needed.