Hi,
what destination buffer size should I use for LzmaEncode?
I found on the web
destLen = srcLen + srcLen/3 + 128;
This is far too large and wasting memory, if I can rely on my tests encoding random data.
For props.dictSize I choose a value near the source data length, is this a good choice?
TIA,
Fred
@Igor: Thank you for providing the LZMA code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
what destination buffer size should I use for LzmaEncode?
I found on the web
destLen = srcLen + srcLen/3 + 128;
This is far too large and wasting memory, if I can rely on my tests encoding random data.
For props.dictSize I choose a value near the source data length, is this a good choice?
TIA,
Fred
@Igor: Thank you for providing the LZMA code.
In most cases
srcLen + srcLen/40 + (1 << 12)
is OK.
But if some "BAD_data" attack is possible, you must support
bigger buffer. I suppose that
srcLen + srcLen/5 + (1 << 16).
is OK for any data.
Thank you for your quick reply!
Regards,
Fred