lzma: make mandatory

Libhtp is starting to use it as well, so its safe to make it mandatory
here.

Remove guards for flash file decompression code.
pull/4160/head
Victor Julien 6 years ago
parent 8d4cbb3f7b
commit dbbdfedb98

@ -610,17 +610,15 @@
if test "$LIBLZMA" != "yes"; then if test "$LIBLZMA" != "yes"; then
echo echo
echo " Warning! liblzma library not found, you will not be" echo " Error! liblzma library not found."
echo " able to decompress flash file compressed with lzma."
echo " Debian/Ubuntu: apt install liblzma-dev" echo " Debian/Ubuntu: apt install liblzma-dev"
echo " Fedora: dnf install xz-devel" echo " Fedora: dnf install xz-devel"
echo " CentOS/RHEL: yum install xz-devel" echo " CentOS/RHEL: yum install xz-devel"
echo echo
enable_liblzma=no exit 1
else fi
enable_liblzma=yes enable_liblzma=yes
LIBS="${TMPLIBS} -llzma" LIBS="${TMPLIBS} -llzma"
fi
#libpcre #libpcre
AC_ARG_WITH(libpcre_includes, AC_ARG_WITH(libpcre_includes,

@ -4638,7 +4638,6 @@ libhtp:\n\
static int DetectEngineHttpServerBodyFileDataTest24(void) static int DetectEngineHttpServerBodyFileDataTest24(void)
{ {
#ifdef HAVE_LIBLZMA
char input[] = "\ char input[] = "\
%YAML 1.1\n\ %YAML 1.1\n\
---\n\ ---\n\
@ -4763,9 +4762,6 @@ libhtp:\n\
UTHFreePackets(&p1, 1); UTHFreePackets(&p1, 1);
UTHFreePackets(&p2, 1); UTHFreePackets(&p2, 1);
PASS; PASS;
#else
PASS;
#endif /* HAVE_LIBLZMA */
} }
static int DetectEngineHttpServerBodyFileDataTest25(void) static int DetectEngineHttpServerBodyFileDataTest25(void)
@ -4895,7 +4891,6 @@ libhtp:\n\
static int DetectEngineHttpServerBodyFileDataTest26(void) static int DetectEngineHttpServerBodyFileDataTest26(void)
{ {
#ifdef HAVE_LIBLZMA
char input[] = "\ char input[] = "\
%YAML 1.1\n\ %YAML 1.1\n\
---\n\ ---\n\
@ -5019,9 +5014,6 @@ libhtp:\n\
UTHFreePackets(&p1, 1); UTHFreePackets(&p1, 1);
UTHFreePackets(&p2, 1); UTHFreePackets(&p2, 1);
PASS; PASS;
#else
PASS;
#endif /* HAVE_LIBLZMA */
} }
static int DetectEngineHttpServerBodyFileDataTest27(void) static int DetectEngineHttpServerBodyFileDataTest27(void)

@ -165,9 +165,6 @@ int FileSwfDecompression(const uint8_t *buffer, uint32_t buffer_len,
} else if ((swf_type == HTTP_SWF_COMPRESSION_LZMA || swf_type == HTTP_SWF_COMPRESSION_BOTH) && } else if ((swf_type == HTTP_SWF_COMPRESSION_LZMA || swf_type == HTTP_SWF_COMPRESSION_BOTH) &&
compression_type == FILE_SWF_LZMA_COMPRESSION) compression_type == FILE_SWF_LZMA_COMPRESSION)
{ {
#ifndef HAVE_LIBLZMA
goto error;
#else
/* we need to setup the lzma header */ /* we need to setup the lzma header */
/* /*
* | 5 bytes | 8 bytes | n bytes | * | 5 bytes | 8 bytes | n bytes |
@ -190,7 +187,6 @@ int FileSwfDecompression(const uint8_t *buffer, uint32_t buffer_len,
out_buffer->buf + 8, out_buffer->len - 8); out_buffer->buf + 8, out_buffer->len - 8);
if (r == 0) if (r == 0)
goto error; goto error;
#endif
} else { } else {
goto error; goto error;
} }

@ -34,9 +34,7 @@
#include <zlib.h> #include <zlib.h>
#ifdef HAVE_LIBLZMA
#include <lzma.h> #include <lzma.h>
#endif
#define MAX_SWF_DECOMPRESSED_LEN 50000000 #define MAX_SWF_DECOMPRESSED_LEN 50000000
/* /*
@ -130,7 +128,6 @@ int FileSwfZlibDecompression(DetectEngineThreadCtx *det_ctx,
* | 4 bytes | 4 bytes | 4 bytes | 5 bytes | n bytes | 6 bytes | * | 4 bytes | 4 bytes | 4 bytes | 5 bytes | n bytes | 6 bytes |
* | 'ZWS' + version | script len | compressed len | LZMA props | LZMA data | LZMA end marker | * | 'ZWS' + version | script len | compressed len | LZMA props | LZMA data | LZMA end marker |
*/ */
#ifdef HAVE_LIBLZMA
int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx, int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
uint8_t *compressed_data, uint32_t compressed_data_len, uint8_t *compressed_data, uint32_t compressed_data_len,
uint8_t *decompressed_data, uint32_t decompressed_data_len) uint8_t *decompressed_data, uint32_t decompressed_data_len)
@ -183,4 +180,3 @@ int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
lzma_end(&strm); lzma_end(&strm);
return ret; return ret;
} }
#endif /* HAVE_LIBLZMA */

@ -35,10 +35,8 @@ uint32_t FileGetSwfDecompressedLen(const uint8_t *buffer, uint32_t buffr_len);
int FileSwfZlibDecompression(DetectEngineThreadCtx *det_ctx, int FileSwfZlibDecompression(DetectEngineThreadCtx *det_ctx,
uint8_t *compressed_data, uint32_t compressed_data_len, uint8_t *compressed_data, uint32_t compressed_data_len,
uint8_t *decompressed_data, uint32_t decompressed_data_len); uint8_t *decompressed_data, uint32_t decompressed_data_len);
#ifdef HAVE_LIBLZMA
int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx, int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
uint8_t *compressed_data, uint32_t compressed_data_len, uint8_t *compressed_data, uint32_t compressed_data_len,
uint8_t *decompressed_data, uint32_t decompressed_data_len); uint8_t *decompressed_data, uint32_t decompressed_data_len);
#endif
#endif /* __UTIL_FILE_SWF_DECOMPRESSION_H__ */ #endif /* __UTIL_FILE_SWF_DECOMPRESSION_H__ */

Loading…
Cancel
Save