mirror of https://github.com/MidnightCommander/mc
Ticket #1392: regression in .tar support
Regression was introduced in lzma support
(a5ba278729
)
All the heuristics stuff has been removed, only
LZMA utils 4.32.1 and later formats are supported.
Signed-off-by: Mikhail S. Pobolovets <styx.mp@gmail.com>
This commit is contained in:
parent
5894396494
commit
ac2edf225e
39
src/util.c
39
src/util.c
|
@ -882,28 +882,21 @@ get_compression_type (int fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LZMA files; both LZMA_Alone and LZMA utils formats. The LZMA_Alone
|
/* Support for LZMA (only utils format with magic in header).
|
||||||
* format is used by the LZMA_Alone tool from LZMA SDK. The LZMA utils
|
* This is the default format of LZMA utils 4.32.1 and later. */
|
||||||
* format is the default format of LZMA utils 4.32.1 and later. */
|
|
||||||
if (magic[0] < 0xE1 || (magic[0] == 0xFF && magic[1] == 'L' &&
|
if (mc_read(fd, (char *) magic+4, 1) == 1)
|
||||||
magic[2] == 'Z' && magic[3] == 'M')) {
|
{
|
||||||
if (mc_read (fd, (char *) magic + 4, 9) == 9) {
|
/* LZMA utils format */
|
||||||
/* LZMA utils format */
|
if
|
||||||
if (magic[0] == 0xFF && magic[4] == 'A' && magic[5] == 0x00)
|
( magic[0] == 0xFF
|
||||||
return COMPRESSION_LZMA;
|
&& magic[1] == 'L'
|
||||||
/* The LZMA_Alone format has no magic bytes, thus we
|
&& magic[2] == 'Z'
|
||||||
* need to play a wizard. This can give false positives,
|
&& magic[3] == 'M'
|
||||||
* thus the detection below should be removed when
|
&& magic[4] == 'A'
|
||||||
* the newer LZMA utils format has got popular. */
|
&& magic[5] == 0x00
|
||||||
if (magic[0] < 0xE1 && magic[4] < 0x20 &&
|
)
|
||||||
((magic[10] == 0x00 && magic[11] == 0x00 &&
|
return COMPRESSION_LZMA;
|
||||||
magic[12] == 0x00) ||
|
|
||||||
(magic[5] == 0xFF && magic[6] == 0xFF &&
|
|
||||||
magic[7] == 0xFF && magic[8] == 0xFF &&
|
|
||||||
magic[9] == 0xFF && magic[10] == 0xFF &&
|
|
||||||
magic[11] == 0xFF && magic[12] == 0xFF)))
|
|
||||||
return COMPRESSION_LZMA;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XZ compression magic */
|
/* XZ compression magic */
|
||||||
|
@ -916,7 +909,7 @@ get_compression_type (int fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return COMPRESSION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
Loading…
Reference in New Issue