Permalink
Browse files

http://code.google.com/p/libarchive/issues/detail?id=325

Simplify the method/level checks here and fix a bug.
  • Loading branch information...
1 parent a7d6214 commit 2bc28c74b640ea8b0d252a766371a15ed40314a3 @kientzle kientzle committed Jul 12, 2013
Showing with 5 additions and 4 deletions.
  1. +5 −4 libarchive/archive_read_support_filter_lzop.c
@@ -242,10 +242,11 @@ consume_header(struct archive_read_filter *self)
if (version >= 0x940) {
unsigned level = *p++;
- if (method == 1 && level == 0) level = 3;
- if (method == 2 && level == 0) level = 1;
- if (method == 3 && level == 0) level = 9;
- if (level < 1 && level > 9) {
+ unsigned default_level[] = {0, 3, 1, 9};
+ if (level == 0)
+ /* Method is 1..3 here due to check above. */
+ level = default_level[method];
+ else if (level > 9) {
archive_set_error(&self->archive->archive,
ARCHIVE_ERRNO_MISC, "Invalid level");
return (ARCHIVE_FAILED);

0 comments on commit 2bc28c7

Please sign in to comment.