1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +00:00

Report the uncompressed size only if it's known

This commit is contained in:
Jukka Ojanen 2021-08-30 16:28:54 +03:00
parent 8324d3cd07
commit 106fe88e4e

View File

@ -18,7 +18,7 @@
/* Maybe _LZMA_NO_SYSTEM_SIZE_T defined? */
#if defined (__clang__) || defined (__GNUC__)
#include <assert.h>
_Static_assert(sizeof(size_t) == sizeof(SizeT), "Check why sizeof(size_t) != sizeof(SizeT)");
_Static_assert(sizeof (size_t) == sizeof (SizeT), "Check why sizeof(size_t) != sizeof(SizeT)");
#endif
#ifndef XZFILE_BUFFER_SIZE
@ -167,7 +167,7 @@ bool hc_fopen (HCFILE *fp, const char *path, const char *mode)
xz_initialized = true;
}
xzfile_t *xfp = (xzfile_t *) hccalloc (1, sizeof(*xfp));
xzfile_t *xfp = (xzfile_t *) hccalloc (1, sizeof (*xfp));
if (xfp == NULL) return false;
/* prepare cache line aligned memory allocator */
@ -619,9 +619,12 @@ int hc_fstat (HCFILE *fp, struct stat *buf)
}
else if (fp->xfp)
{
/* uncompressed bytes */
/* check that the uncompressed size is known */
const xzfile_t *xfp = fp->xfp;
buf->st_size = (off_t) xfp->outSize;
if (xfp->outSize != (UInt64)((Int64)-1))
{
buf->st_size = (off_t) xfp->outSize;
}
}
return r;