Skip to content

Fixed runtime error and uninitialized variable usage #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libmspack/mspack/cabd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,11 @@ static unsigned int cabd_checksum(unsigned char *data, unsigned int bytes,
unsigned int len, ul = 0;

for (len = bytes >> 2; len--; data += 4) {
cksum ^= ((data[0]) | (data[1]<<8) | (data[2]<<16) | (data[3]<<24));
unsigned int byte0 = data[0];
unsigned int byte1 = ((unsigned int)data[1]) << 8;
unsigned int byte2 = ((unsigned int)data[2]) << 16;
unsigned int byte3 = ((unsigned int)data[3]) << 24;
cksum ^= (byte0 | byte1 | byte2 | byte3);
}

switch (bytes & 3) {
Expand Down
8 changes: 4 additions & 4 deletions libmspack/mspack/chmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,11 @@ static int chmd_sys_write(struct mspack_file *file, void *buffer, int bytes) {
static int chmd_init_decomp(struct mschm_decompressor_p *self,
struct mschmd_file *file)
{
int window_size, window_bits, reset_interval, entry, err;
int window_size = 0, window_bits = 0, reset_interval = 0, entry = 0, err = 0;
struct mspack_system *sys = self->system;
struct mschmd_sec_mscompressed *sec;
unsigned char *data;
off_t length, offset;
struct mschmd_sec_mscompressed *sec = NULL;
unsigned char *data = NULL;
off_t length = 0, offset = 0;

sec = (struct mschmd_sec_mscompressed *) file->section;

Expand Down