Skip to content

Commit

Permalink
Fix infinite loop with certain corrupt files.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed May 24, 2024
1 parent 8a0c19d commit e453eb1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libyara/modules/pe/pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,11 @@ static void* pe_parse_delayed_imports(PE* pe)
offset = pe_rva_to_offset(pe, nameAddress + sizeof(uint16_t));

if (offset < 0)
{
name_rva += pointer_size;
func_rva += pointer_size;
continue;
}

func_name = (char*) yr_strndup(
(char*) (pe->data + offset),
Expand All @@ -1454,7 +1458,7 @@ static void* pe_parse_delayed_imports(PE* pe)
sizeof(IMPORT_FUNCTION));

if (imported_func == NULL)
continue;
break;

imported_func->name = func_name;
imported_func->rva = func_rva;
Expand Down

0 comments on commit e453eb1

Please sign in to comment.