mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Fix apelink shell script corruption bug
We were using a shell heredoc value '@' to terminate the dos stub, but that's not sufficiently safe. We found out sh doesn't consider control characters as contributing to the start of a line, and had the unlucky chance of the linker choosing the number 2624 for e_lfanew, and that's "@\n" in ASCII, which compromised the APE shell script. We now use the heredoc 'justineXXXXXX' with 31 bits of entropy, that's determistically generated by hashing apelink inputs w/ crc32 / blake2b
This commit is contained in:
parent
2366848db5
commit
a033b65a33
3 changed files with 48 additions and 77 deletions
|
@ -123,7 +123,7 @@ Cosmopolitan's third_party/gcc/ for source code and copying conditions.
|
|||
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
EOF
|
||||
exit 0
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" = "--help" ]; then
|
||||
|
@ -303,7 +303,7 @@ for x; do
|
|||
elif [ x"$x" = x"-fsanitize=all" ] ||
|
||||
[ x"$x" = x"-fsanitize=address" ] ||
|
||||
[ x"$x" = x"-fsanitize=undefined" ]; then
|
||||
fatal_error "$x use cosmo MODE=dbg rather than passing $x"
|
||||
fatal_error "use cosmo MODE=dbg rather than passing $x"
|
||||
elif [ x"$x" = x"-mno-red-zone" ]; then
|
||||
# "Any memory below the stack beyond the red zone is considered
|
||||
# volatile and may be modified by the operating system at any time."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue