Skip to content

Commit

Permalink
bb#474
Browse files Browse the repository at this point in the history
git-svn: trunk@3544
  • Loading branch information
aCaB committed Jan 25, 2008
1 parent a6de01a commit fee30f6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
6 changes: 5 additions & 1 deletion libclamunrar/unrarppm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
21 changes: 18 additions & 3 deletions libclamunrar/unrarppm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand Down

0 comments on commit fee30f6

Please sign in to comment.