Skip to content

Commit f376fe6

Browse files
authored
Merge pull request #266 from neheb/int
fix wrong cast
2 parents 0ad9548 + 1af4453 commit f376fe6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/patchelf.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,13 @@ ElfFile<ElfFileParamNames>::ElfFile(FileContents fileContents)
397397
if (rdi(hdr->e_type) != ET_EXEC && rdi(hdr->e_type) != ET_DYN)
398398
error("wrong ELF type");
399399

400-
if (size_t(rdi(hdr->e_phoff) + rdi(hdr->e_phnum)) * rdi(hdr->e_phentsize) > fileContents->size())
400+
if (rdi(hdr->e_phoff) + size_t(rdi(hdr->e_phnum) * rdi(hdr->e_phentsize)) > fileContents->size())
401401
error("program header table out of bounds");
402402

403403
if (rdi(hdr->e_shnum) == 0)
404404
error("no section headers. The input file is probably a statically linked, self-decompressing binary");
405405

406-
if (size_t(rdi(hdr->e_shoff) + rdi(hdr->e_shnum)) * rdi(hdr->e_shentsize) > fileContents->size())
406+
if (rdi(hdr->e_shoff) + size_t(rdi(hdr->e_shnum) * rdi(hdr->e_shentsize)) > fileContents->size())
407407
error("section header table out of bounds");
408408

409409
if (rdi(hdr->e_phentsize) != sizeof(Elf_Phdr))

0 commit comments

Comments
 (0)