diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-04-30 22:16:17 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-04-30 22:16:17 +0300 |
commit | 8e074349e47ea6832b8fdf9244e581d453733433 (patch) | |
tree | b4cf1cec021d1f8245148cc2aa16053402e24408 /src/lzma | |
parent | Updated THANKS. (diff) | |
download | xz-8e074349e47ea6832b8fdf9244e581d453733433.tar.xz |
Fix a crash with --format=alone if other filters than LZMA
are specified on the command line.
Diffstat (limited to 'src/lzma')
-rw-r--r-- | src/lzma/args.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lzma/args.c b/src/lzma/args.c index 24fc0939..4393a6bd 100644 --- a/src/lzma/args.c +++ b/src/lzma/args.c @@ -462,6 +462,15 @@ set_compression_settings(void) // Terminate the filter options array. opt_filters[filter_count].id = LZMA_VLI_VALUE_UNKNOWN; + // If we are using the LZMA_Alone format, allow exactly one filter + // which has to be LZMA. + if (opt_header == HEADER_ALONE && (filter_count != 1 + || opt_filters[0].id != LZMA_FILTER_LZMA)) { + errmsg(V_ERROR, _("With --format=alone only the LZMA filter " + "is supported")); + my_exit(ERROR); + } + // Optimize the filter chain a little by removing all // Copy filters. for (size_t i = 0; opt_filters[i].id != LZMA_VLI_VALUE_UNKNOWN; ++i) { |