]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add Test Validating Stack is not Executable in playTests.sh
authorW. Felix Handte <w@felixhandte.com>
Thu, 30 Dec 2021 02:42:32 +0000 (18:42 -0800)
committerW. Felix Handte <w@felixhandte.com>
Tue, 4 Jan 2022 21:57:35 +0000 (16:57 -0500)
tests/playTests.sh

index a772b61ff7c7e2d6d28a3185f152ad549e16c623..e1da24a4b06bf981913bb7baae8192fefd741977 100755 (executable)
@@ -304,6 +304,15 @@ zstd -d -f tmp_corrupt.zst --no-check
 zstd -d -f tmp_corrupt.zst --check --no-check # final flag overrides
 zstd -d -f tmp.zst --no-check
 
+if [ "$isWindows" = false ]; then
+  if [ -n "$(which readelf)" ]; then
+    println "test: check if binary has executable stack"
+    file "$ZSTD_BIN"
+    readelf -lW "$ZSTD_BIN"
+    readelf -lW "$ZSTD_BIN" | grep 'GNU_STACK .* RW ' || die "zstd binary has executable stack!"
+  fi
+fi
+
 println "\n===> zstdgrep tests"
 ln -sf "$ZSTD_BIN" zstdcat
 rm -f tmp_grep