ukify: extend error message when section is too small

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-08-19 10:46:36 +02:00
parent 58c2e99012
commit dbd7b16819
+4 -1
View File
@@ -1045,7 +1045,10 @@ def pe_add_sections(opts: UkifyConfig, uki: UKI, output: str) -> None:
for i, s in enumerate(pe.sections[:n_original_sections]):
if pe_strip_section_name(s.Name) == section.name and section.name != '.dtbauto':
if new_section.Misc_VirtualSize > s.SizeOfRawData:
raise PEError(f'Not enough space in existing section {section.name} to append new data')
raise PEError(
f'Not enough space in existing section {section.name} to append new data'
f' (need {new_section.Misc_VirtualSize}, have {s.SizeOfRawData})'
)
padding = bytes(new_section.SizeOfRawData - new_section.Misc_VirtualSize)
pe.__data__ = (