Skip to content

Commit e453eb1

Browse files
committed
Fix infinite loop with certain corrupt files.
1 parent 8a0c19d commit e453eb1

File tree

1 file changed

+5
-1
lines changed
  • libyara/modules/pe

1 file changed

+5
-1
lines changed

libyara/modules/pe/pe.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,11 @@ static void* pe_parse_delayed_imports(PE* pe)
14371437
offset = pe_rva_to_offset(pe, nameAddress + sizeof(uint16_t));
14381438

14391439
if (offset < 0)
1440+
{
1441+
name_rva += pointer_size;
1442+
func_rva += pointer_size;
14401443
continue;
1444+
}
14411445

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

14561460
if (imported_func == NULL)
1457-
continue;
1461+
break;
14581462

14591463
imported_func->name = func_name;
14601464
imported_func->rva = func_rva;

0 commit comments

Comments
 (0)