Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,11 @@ execute() {
}

# Fail with a clear message if the input contains any bell characters.
if eval "[ \"\${*#*${lsep}}\" != \"\$*\" ]"; then
die "Compiler command line contains our separator ('${lsep}'). Cannot parse."
fi
case "$*" in
*"$lsep"*)
die "Compiler command line contains our separator ('${lsep}'). Cannot parse."
;;
esac

# ensure required variables are set
for param in $params; do
Expand Down
14 changes: 14 additions & 0 deletions test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,19 @@ test_no_wrapper_environment() {
esac
}

test_separator_in_args() {
wrapper_environment
_out=$("$WRAPPER_DIR/cc" "hello$(printf '\a')world" 2>&1)
_rc=$?
if [ "$_rc" -eq 0 ]; then
fail "cc with bell char in args unexpectedly exited 0"
fi
case "$_out" in
*"Compiler command line contains our separator"*) ;;
*) fail "expected 'Compiler command line contains our separator' in: $_out" ;;
esac
}

test_modes() {
wrapper_environment

Expand Down Expand Up @@ -1017,6 +1030,7 @@ expected: $_expected_LR"

all_tests='
test_no_wrapper_environment
test_separator_in_args
test_modes
test_expected_args
test_expected_args_with_flags
Expand Down