Skip to content

Commit

Permalink
skip signature check if null (hlos)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Dec 31, 2023
1 parent 733b6a1 commit bfc3956
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ int hl_module_capture_stack_range( void *stack_top, void **stack_ptr, void **out
code_size -= s;
if( module_addr < (void*)code || module_addr >= (void*)(code + code_size) ) continue;
}
if( out )
if( out )
out[count++] = module_addr;
else
count++;
Expand Down Expand Up @@ -324,7 +324,7 @@ static void append_fields( char **p, hl_type *t ) {
#define DISABLED_LIB_PTR ((void*)(int_val)2)

static void *resolve_library( const char *lib, bool is_opt ) {
char tmp[256];
char tmp[256];
void *h;

# ifndef HL_CONSOLE
Expand All @@ -346,7 +346,7 @@ static void *resolve_library( const char *lib, bool is_opt ) {

if( strcmp(lib,"std") == 0 ) {
# ifdef HL_WIN
# ifdef HL_64
# ifdef HL_64
h = dlopen("libhl64.dll",RTLD_LAZY);
if( h == NULL ) h = dlopen("libhl.dll",RTLD_LAZY);
# else
Expand All @@ -358,15 +358,15 @@ static void *resolve_library( const char *lib, bool is_opt ) {
return RTLD_DEFAULT;
# endif
}

strcpy(tmp,lib);

# ifdef HL_64
strcpy(tmp+strlen(lib),"64.hdll");
h = dlopen(tmp,RTLD_LAZY);
if( h != NULL ) return h;
# endif

strcpy(tmp+strlen(lib),".hdll");
h = dlopen(tmp,RTLD_LAZY);
if( h == NULL && !is_opt )
Expand Down Expand Up @@ -438,7 +438,7 @@ static void hl_module_init_indexes( hl_module *m ) {
for(i=0;i<m->code->nfunctions;i++) {
int k;
hl_function *f = m->code->functions + i;
hl_function *real_f = f;
hl_function *real_f = f;
while( real_f && !real_f->obj ) real_f = real_f->field.ref;
if( real_f == NULL ) continue;
for(k=0;k<f->nops;k++) {
Expand Down Expand Up @@ -570,7 +570,7 @@ static void hl_module_init_natives( hl_module *m ) {
p = tmp;
append_type(&p,n->t);
*p++ = 0;
if( memcmp(sign,tmp,strlen(sign)+1) != 0 )
if( sign && memcmp(sign,tmp,strlen(sign)+1) != 0 )
hl_fatal4("Invalid signature for function %s@%s : %s required but %s found in hdll",n->lib,n->name,tmp,sign);
}
}
Expand Down Expand Up @@ -680,7 +680,7 @@ int hl_module_init( hl_module *m, h_bool hot_reload ) {
hl_constant *c = m->code->constants + i;
hl_module_init_constant(m, c);
}

# ifdef HL_VTUNE
hl_module_init_vtune(m);
# endif
Expand Down Expand Up @@ -721,7 +721,7 @@ h_bool hl_module_patch( hl_module *m1, hl_code *c ) {
}
memset(m2->globals_data+m1->globals_size,0,gsize - m1->globals_size);
m2->globals_size = gsize;

hl_module_init_natives(m2);
hl_module_init_indexes(m2);
hl_jit_reset(ctx, m2);
Expand Down Expand Up @@ -866,7 +866,7 @@ h_bool hl_module_patch( hl_module *m1, hl_code *c ) {
fflush(stdout);
return false;
}

for(i=0;i<m2->code->nfunctions;i++) {
hl_function *f2 = m2->code->functions + i;
if( m2->hash->functions_hashes[i] < -1 ) continue;
Expand Down

0 comments on commit bfc3956

Please sign in to comment.