tukaani-project / xz

XZ Utils
https://tukaani.org/xz/
Other
532 stars 95 forks source link

[Bug]: lzma_lzma_preset() returns success if preset is unusable #37

Closed JiaT75 closed 1 year ago

JiaT75 commented 1 year ago

Describe the bug

If LZMA_MF_HC3 or LZMA_MF_HC4 are disabled for preset level <=3, or if LZMA_MF_BT4 is disabled for the other levels, then lzma_lzma_preset still returns success. When lzma_options_lzma * is used, it will cause an error.

The solution to this can be done either in code or in documentation. The code change would be simple to check if the needed match finders were configured.

Instead, a documentation change in lzma12.h could make it clear that the preset is valid, but might not work depending on the liblzma configuration (in this case, which match finders were built).

Version

5.5.0alpha

Operating System

N/A

Relevant log output

No response