/* Generates a jump validator. */ Bool NaClJumpValidatorInitialize(NaClValidatorState* vstate) { NaClJumpSets* jump_sets = &vstate->jump_sets; jump_sets->actual_targets = NaClAddressSetCreate(vstate->codesize); jump_sets->possible_targets = NaClAddressSetCreate(vstate->codesize); jump_sets->removed_targets = NaClAddressSetCreate(vstate->codesize); if (jump_sets->actual_targets == NULL || jump_sets->possible_targets == NULL || jump_sets->removed_targets == NULL) { NaClValidatorMessage(LOG_ERROR, vstate, "unable to allocate jump sets"); NaClJumpValidatorCleanUp(vstate); return FALSE; } jump_sets->set_array_size = NaClAddressSetArraySize(vstate->codesize); return TRUE; }
NaClAddressSet NaClAddressSetCreate(NaClMemorySize size) { return (NaClAddressSet) calloc(NaClAddressSetArraySize(size), sizeof(uint8_t)); }