Skip to content

Commit

Permalink
Sync our ClamAV unrar to the last version that existed in plain C
Browse files Browse the repository at this point in the history
This is no longer maintained.  We might need to switch to the newer C++
version, that's also closer (identical?) to the official code.
  • Loading branch information
magnumripper committed Jan 27, 2025
1 parent 9777679 commit 30c0c03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/unrar.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,11 @@ static int read_tables(const unsigned char **fd, unpack_data_t *unpack_data)
n = (rar_getbits(unpack_data) >> 9) + 11;
rar_addbits(unpack_data, 7);
}
if (i == 0) {
return 0;
}
while (n-- > 0 && i < table_size) {
if (i>0)
table[i] = table[i-1];
table[i] = table[i - 1];
i++;
}
} else {
Expand Down Expand Up @@ -904,9 +906,9 @@ void rar_unpack_init_data(int solid, unpack_data_t *unpack_data)
memset(unpack_data->old_dist, 0, sizeof(unpack_data->old_dist));
unpack_data->old_dist_ptr= 0;
memset(unpack_data->unp_old_table, 0, sizeof(unpack_data->unp_old_table));
memset(&unpack_data->LDD, 0, sizeof(unpack_data->LDD));
memset(&unpack_data->LD, 0, sizeof(unpack_data->LD));
memset(&unpack_data->DD, 0, sizeof(unpack_data->DD));
memset(&unpack_data->LDD, 0, sizeof(unpack_data->LDD));
memset(&unpack_data->RD, 0, sizeof(unpack_data->RD));
memset(&unpack_data->BD, 0, sizeof(unpack_data->BD));
unpack_data->last_dist= 0;
Expand Down
10 changes: 4 additions & 6 deletions src/unrarvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#define VM_GLOBALMEMSIZE 0x2000
#define VM_FIXEDGLOBALSIZE 64

#define VM_FC 1
#define VM_FZ 2
#define VM_FS 0x80000000

typedef enum rarvm_commands
{
VM_MOV, VM_CMP, VM_ADD, VM_SUB, VM_JZ, VM_JNZ, VM_INC, VM_DEC,
Expand All @@ -49,12 +53,6 @@ typedef enum rarvm_standard_filters {
VMSF_DELTA, VMSF_UPCASE
} rarvm_standard_filters_t;

enum VM_Flags {
VM_FC=1,
VM_FZ=2,
VM_FS=0x80000000
};

enum rarvm_op_type {
VM_OPREG,
VM_OPINT,
Expand Down

0 comments on commit 30c0c03

Please sign in to comment.