From 0fae649ddad12fd79c011a88954a1eba766f5d35 Mon Sep 17 00:00:00 2001 From: Guilherme Dantas Date: Sun, 8 Sep 2024 20:27:13 -0300 Subject: [PATCH] Add line length limit in Solidity bounty (#150) --- tests/bounties/solidity-bounty/start.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/bounties/solidity-bounty/start.sh b/tests/bounties/solidity-bounty/start.sh index c47ccdd..d280b01 100755 --- a/tests/bounties/solidity-bounty/start.sh +++ b/tests/bounties/solidity-bounty/start.sh @@ -22,6 +22,17 @@ if [ $status -ne 1 ]; then exit 1 fi +# +# Validate line length limit - Avoids extremely long SPDX license identifiers, +# which causes catastrophic backtracking in regex pattern matching +# See: https://github.com/ethereum/solidity/issues/12208 +# +awk 'length > 1000 { exit 1 }' $1 +status=$? +if [ $status -ne 0 ]; then + >&2 echo "Invalid exploit code: Exceeded line length limit" + exit 1 +fi # # Run the exploit code