LIEF icon indicating copy to clipboard operation
LIEF copied to clipboard

Tutorial script for "Create a PE from scratch" broken

Open Nordwald opened this issue 2 years ago • 4 comments

Describe the bug The script to the tutorial 02 - Create a PE from scratch is completely broken.

  • There is no optional header
  • Sections are unnamed
  • Sections are overlapping
  • Sections are extremely big (e.g. 0x400061 to 0x74a1648f)
  • There is no import table

To Reproduce Follow the steps in 02 - Create a PE from scratch or execute the tutorial script: pe_from_scratch.py

Expected behavior Working executable with correct headers and sections

Environment (please complete the following information):

  • System and Version : Fedora 36
  • Target format: PE
  • LIEF commit version: 0.12.1-c7b3ce3b

Nordwald avatar Jul 12 '22 12:07 Nordwald

Screenshot from 2022-07-12 14-18-48

Nordwald avatar Jul 12 '22 12:07 Nordwald

Ack (I won't likely have a fix soon)

romainthomas avatar Jul 14 '22 13:07 romainthomas

I believe this is the same issue as https://github.com/lief-project/LIEF/issues/733 which was fixed by https://github.com/lief-project/LIEF/pull/734. Could you try to test the latest commit?

ZehMatt avatar Jul 22 '22 12:07 ZehMatt

I just test the script and use radare2 to analyze the generated PE file, it seems the problem still exists.

[0x00400074]> iS
[Sections]

nth paddr        size vaddr            vsize perm name
――――――――――――――――――――――――――――――――――――――――――――――――――――――
0   0x00001000   0x1c 0x00400074  0x78658000 ---- sect_0
1   0x00002000   0x1c 0x00400061  0x74617000 ---- sect_1
2   0x00003000  0x200 0x00400000    0x317000 ---- sect_2

chinggg avatar Jul 28 '22 08:07 chinggg