tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Files output by TCC are technically corrupt


From: Ben Hutchinson
Subject: [Tinycc-devel] Files output by TCC are technically corrupt
Date: Mon, 28 Dec 2015 00:49:53 -0800

When TCC outputs an EXE file, while that file does run (luckily) the EXE file is missing the SizeOfCode and SizeOfData fields in the PE header. Actually, they aren't missing, but they are left at the value 0 (zero), which is incorrect. This means that technically the EXE file is an invalid EXE file. SizeOfCode should be the size (in bytes) of the .text section of the EXE file, rounded up to the nearest multiple of 4096. Likewise, SizeOfData should be the size (in bytes) of the .data section, rounded up to the nearest multiple of 4096. While this corrupt EXE file does run, there's no guarenty that in future versions of Windows that it will still be able to run. Microsoft might start more strictly enforcing the PE header standard, and then all EXE files output by TCC will no longer be able to run.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]