Skip to content

Commit

Permalink
Worked on tolerance of corrupted compressed data
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed May 16, 2021
1 parent 1ca7370 commit 264d004
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 18 deletions.
10 changes: 10 additions & 0 deletions common/types.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ typedef int system_integer_t;
#define UINT32_MAX (0xffffffffUL)
#endif

/* The minimum signed 64-bit integer is -9223372036854775808 (0x8000000000000000)
*/
#if !defined( INT64_MIN )
#if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
#define INT64_MIN (0x8000000000000000UL)
#else
#define INT64_MIN (0x8000000000000000ULL)
#endif
#endif /* !defined( INT64_MIN ) */

/* The maximum signed 64-bit integer is 9223372036854775807 (0x7fffffffffffffff)
*/
#if !defined( INT64_MAX )
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )

AC_INIT(
[libewf],
[20140811],
[20140812],
[joachim.metz@gmail.com])

AC_CONFIG_SRCDIR(
Expand Down
2 changes: 1 addition & 1 deletion dpkg/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Upstream-Name: libewf
Source: https://github.com/libyal/libewf

Files: *
Copyright: 2006-2020, Joachim Metz <joachim.metz@gmail.com>
Copyright: 2006-2021, Joachim Metz <joachim.metz@gmail.com>
License: LGPL-3.0+

License: LGPL-3.0+
Expand Down
6 changes: 3 additions & 3 deletions libewf.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<package >
<metadata>
<id>libewf</id>
<version>20140811</version>
<version>20140812</version>
<authors>Joachim Metz</authors>
<owners>joachimmetz</owners>
<license type="expression">LGPL-3.0-or-later</license>
<projectUrl>https://github.com/libyal/libewf</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<title>libewf</title>
<description>Library to access the Expert Witness Compression Format (EWF) format</description>
<releaseNotes>Release of libewf 20201122</releaseNotes>
<copyright>Copyright (C) 2006-2020</copyright>
<releaseNotes>Release of libewf 20140812</releaseNotes>
<copyright>Copyright (C) 2006-2021</copyright>
<tags>native</tags>
</metadata>
<files>
Expand Down
17 changes: 14 additions & 3 deletions libewf/libewf_chunk_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ int libewf_chunk_data_unpack(
&( chunk_data->data_size ),
error );

/* TODO handle chunk with zlib data corruption */
if( result == -1 )
{
libcerror_error_set(
Expand All @@ -565,9 +564,21 @@ int libewf_chunk_data_unpack(
"%s: unable to decompress chunk data.",
function );

return( -1 );
#if defined( HAVE_DEBUG_OUTPUT )
if( libcnotify_verbose != 0 )
{
if( ( error != NULL )
&& ( *error != NULL ) )
{
libcnotify_print_error_backtrace(
*error );
}
}
#endif
libcerror_error_free(
error );
}
else if( result == 0 )
if( result != 1 )
{
#if defined( HAVE_VERBOSE_OUTPUT )
if( libcnotify_verbose != 0 )
Expand Down
4 changes: 2 additions & 2 deletions pyewf/pyewf_datetime.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PyObject *pyewf_datetime_new_from_time_elements(
uint8_t hours,
uint8_t minutes,
uint8_t seconds,
uint8_t micro_seconds )
uint32_t micro_seconds )
{
PyObject *datetime_object = NULL;
static char *function = "pyewf_datetime_new_from_time_elements";
Expand Down Expand Up @@ -163,7 +163,7 @@ PyObject *pyewf_datetime_new_from_time_elements(
(int) hours,
(int) minutes,
(int) seconds,
0 );
(int) micro_seconds );

return( datetime_object );
}
Expand Down
2 changes: 1 addition & 1 deletion pyewf/pyewf_datetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PyObject *pyewf_datetime_new_from_time_elements(
uint8_t hours,
uint8_t minutes,
uint8_t seconds,
uint8_t micro_seconds );
uint32_t micro_seconds );

PyObject *pyewf_datetime_new_from_fat_date_time(
uint32_t fat_date_time );
Expand Down
4 changes: 2 additions & 2 deletions runtests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# Script that runs the tests
#
# Version: 20190103
# Version: 20210503

EXIT_SUCCESS=0;
EXIT_FAILURE=1;
Expand Down Expand Up @@ -412,7 +412,7 @@ fi

if test ${HAVE_ENABLE_STATIC_EXECUTABLES} -eq 0;
then
run_configure_make_check "--enable-static-executables";
run_configure_make_check "--enable-static-executables --enable-multi-threading-support=no --with-libfuse=no";
RESULT=$?;

if test ${RESULT} -ne ${EXIT_SUCCESS};
Expand Down
11 changes: 10 additions & 1 deletion synclibs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# Script that synchronizes the local library dependencies
#
# Version: 20191229
# Version: 20210513

EXIT_SUCCESS=0;
EXIT_FAILURE=1;
Expand Down Expand Up @@ -143,6 +143,15 @@ SED_SCRIPT="/^$/ {
fi
fi

# Make the necessary changes to libfplist/Makefile.am
if test ${LOCAL_LIB} = "libfplist";
then
if test -f "m4/libfdatetime.m4";
then
sed -i'~' '/@LIBFGUID_CPPFLAGS@/{h; s/FGUID/FDATETIME/; p; g;}' ${LOCAL_LIB_MAKEFILE_AM};
fi
fi

# Make the necessary changes to libfvalue/Makefile.am
if test ${LOCAL_LIB} = "libfvalue";
then
Expand Down
4 changes: 0 additions & 4 deletions tests/ewf_test_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,15 +1108,11 @@ int ewf_test_glob_free(
libcerror_error_free(
&error );

filenames = (char **) 0x12345678UL;

result = libewf_glob_free(
filenames,
-1,
&error );

filenames = NULL;

EWF_TEST_ASSERT_EQUAL_INT(
"result",
result,
Expand Down

0 comments on commit 264d004

Please sign in to comment.