Correcting potential segfault due to division by 0
This happend when passing a weird file name to cmph in generate or verbose mode. To get the crash test script and full report, refer to: http://bugs.debian.org/715745
This commit is contained in:
parent
2cf5c15cf6
commit
2e797796a5
@ -89,7 +89,10 @@ jenkins_state_t *jenkins_state_new(cmph_uint32 size) //size of hash table
|
|||||||
jenkins_state_t *state = (jenkins_state_t *)malloc(sizeof(jenkins_state_t));
|
jenkins_state_t *state = (jenkins_state_t *)malloc(sizeof(jenkins_state_t));
|
||||||
if (!state) return NULL;
|
if (!state) return NULL;
|
||||||
DEBUGP("Initializing jenkins hash\n");
|
DEBUGP("Initializing jenkins hash\n");
|
||||||
|
if(size > 0)
|
||||||
state->seed = ((cmph_uint32)rand() % size);
|
state->seed = ((cmph_uint32)rand() % size);
|
||||||
|
else
|
||||||
|
state->seed = 0;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
void jenkins_state_destroy(jenkins_state_t *state)
|
void jenkins_state_destroy(jenkins_state_t *state)
|
||||||
|
Loading…
Reference in New Issue
Block a user