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

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

@ -4638,7 +4638,6 @@ libhtp:\n\
static int DetectEngineHttpServerBodyFileDataTest24(void)
{
#ifdef HAVE_LIBLZMA
char input[] = "\
%YAML 1.1\n\
---\n\
@ -4763,9 +4762,6 @@ libhtp:\n\
UTHFreePackets(&p1, 1);
UTHFreePackets(&p2, 1);
PASS;
#else
PASS;
#endif /* HAVE_LIBLZMA */
}
static int DetectEngineHttpServerBodyFileDataTest25(void)
@ -4895,7 +4891,6 @@ libhtp:\n\
static int DetectEngineHttpServerBodyFileDataTest26(void)
{
#ifdef HAVE_LIBLZMA
char input[] = "\
%YAML 1.1\n\
---\n\
@ -5019,9 +5014,6 @@ libhtp:\n\
UTHFreePackets(&p1, 1);
UTHFreePackets(&p2, 1);
PASS;
#else
PASS;
#endif /* HAVE_LIBLZMA */
}
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) &&
compression_type == FILE_SWF_LZMA_COMPRESSION)
{
#ifndef HAVE_LIBLZMA
goto error;
#else
/* we need to setup the lzma header */
/*
* | 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);
if (r == 0)
goto error;
#endif
} else {
goto error;
}

@ -34,9 +34,7 @@
#include <zlib.h>
#ifdef HAVE_LIBLZMA
#include <lzma.h>
#endif
#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 |
* | 'ZWS' + version | script len | compressed len | LZMA props | LZMA data | LZMA end marker |
*/
#ifdef HAVE_LIBLZMA
int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
uint8_t *compressed_data, uint32_t compressed_data_len,
uint8_t *decompressed_data, uint32_t decompressed_data_len)
@ -183,4 +180,3 @@ int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
lzma_end(&strm);
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,
uint8_t *compressed_data, uint32_t compressed_data_len,
uint8_t *decompressed_data, uint32_t decompressed_data_len);
#ifdef HAVE_LIBLZMA
int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
uint8_t *compressed_data, uint32_t compressed_data_len,
uint8_t *decompressed_data, uint32_t decompressed_data_len);
#endif
#endif /* __UTIL_FILE_SWF_DECOMPRESSION_H__ */

Loading…
Cancel
Save