1.0.80 release

This commit is contained in:
longpanda
2022-09-21 19:41:51 +08:00
parent 6b22a6200e
commit 17f9e2fd09
31 changed files with 844 additions and 120 deletions

View File

@@ -32,6 +32,7 @@
#include "wimboot.h"
#include "vdisk.h"
#include "lzx.h"
#include "xca.h"
#include "wim.h"
/** WIM chunk buffer */
@@ -180,6 +181,8 @@ static int wim_chunk ( struct vdisk_file *file, struct wim_header *header,
/* Identify decompressor */
if ( header->flags & WIM_HDR_LZX ) {
decompress = lzx_decompress;
} else if (header->flags & WIM_HDR_XPRESS) {
decompress = xca_decompress;
} else {
DBG ( "Can't handle unknown compression scheme %#08x "
"for %#llx chunk %d at [%#llx+%#llx)\n",
@@ -447,8 +450,10 @@ int wim_path ( struct vdisk_file *file, struct wim_header *header,
return rc;
/* Get root directory offset */
direntry->subdir = ( ( security.len + sizeof ( uint64_t ) - 1 ) &
~( sizeof ( uint64_t ) - 1 ) );
if (security.len > 0)
direntry->subdir = ( ( security.len + sizeof ( uint64_t ) - 1 ) & ~( sizeof ( uint64_t ) - 1 ) );
else
direntry->subdir = security.len + 8;
/* Find directory entry */
name = memcpy ( path_copy, path, sizeof ( path_copy ) );

View File

@@ -42,7 +42,7 @@
*/
ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
const void *src = data;
const void *end = ( src + len );
const void *end = ( uint8_t * ) src + len;
uint8_t *out = buf;
size_t out_len = 0;
size_t out_len_threshold = 0;
@@ -67,11 +67,9 @@ ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
/* Construct symbol lengths */
lengths = src;
src += sizeof ( *lengths );
src = ( uint8_t * ) src + sizeof ( *lengths );
if ( src > end ) {
DBG ( "XCA too short to hold Huffman lengths "
"table at input offset %#zx\n",
( src - data ) );
DBG ( "XCA too short to hold Huffman lengths table.\n");
return -1;
}
for ( raw = 0 ; raw < XCA_CODES ; raw++ )
@@ -113,7 +111,7 @@ ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
out_len++;
} else if ( ( raw == XCA_END_MARKER ) &&
( src >= ( end - 1 ) ) ) {
( (uint8_t *) src >= ( ( uint8_t * ) end - 1 ) ) ) {
/* End marker symbol */
return out_len;
@@ -157,6 +155,5 @@ ssize_t xca_decompress ( const void *data, size_t len, void *buf ) {
}
}
DBG ( "XCA input overrun at output length %#zx\n", out_len );
return -1;
return out_len;
}