diff --git a/ChangeLog b/ChangeLog index a252fb6b5a..35ef951ffc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Jan 25 17:16:53 CET 2008 (acab) +----------------------------------- + * libclamunrar: same behaviour on 32bit and 64bit systems - bb#474 + Fri Jan 25 18:15:21 EET 2008 (edwin) ------------------------------------ * libclamav/htmlnorm.[ch]: handle NULL characters in HTML files. (bb #539). diff --git a/libclamunrar/unrarppm.c b/libclamunrar/unrarppm.c index 343fcad63b..1679e53987 100644 --- a/libclamunrar/unrarppm.c +++ b/libclamunrar/unrarppm.c @@ -104,12 +104,16 @@ static int sub_allocator_start_sub_allocator(sub_allocator_t *sub_alloc, int sa_ return TRUE; } sub_allocator_stop_sub_allocator(sub_alloc); + if (t>138412020) { + rar_dbgmsg("too much memory needed for uncompressing this file\n"); + return FALSE; + } alloc_size = t/FIXED_UNIT_SIZE*UNIT_SIZE+UNIT_SIZE; #if defined(__sparc) || defined(sparc) || defined(__sparcv9) /* Allow for aligned access requirements */ alloc_size += UNIT_SIZE; #endif - if ((sub_alloc->heap_start = (uint8_t *) rar_malloc(alloc_size)) == NULL) { + if ((sub_alloc->heap_start = (uint8_t *) malloc(alloc_size)) == NULL) { rar_dbgmsg("sub_alloc start failed\n"); return FALSE; } diff --git a/libclamunrar/unrarppm.h b/libclamunrar/unrarppm.h index 4a51463e97..a588a19e59 100644 --- a/libclamunrar/unrarppm.h +++ b/libclamunrar/unrarppm.h @@ -59,18 +59,27 @@ struct see2_context_tag uint8_t shift, count; }; +#ifndef HAVE_ATTRIB_PACKED +#define __attribute__(x) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +#ifdef HAVE_PRAGMA_PACK_HPPA +#pragma pack 1 +#endif struct state_tag { struct ppm_context *successor; uint8_t symbol; uint8_t freq; -}; +} __attribute__((packed)); struct freq_data_tag { struct state_tag *stats; uint16_t summ_freq; -}; +} __attribute__((packed)); struct ppm_context { struct ppm_context *suffix; @@ -79,7 +88,13 @@ struct ppm_context { struct state_tag one_state; } con_ut; uint16_t num_stats; -}; +} __attribute__((packed)); +#ifdef HAVE_PRAGMA_PACK +#pragma pack() +#endif +#ifdef HAVE_PRAGMA_PACK_HPPA +#pragma pack +#endif typedef struct ppm_data_tag {