#!/bin/bash
# (C) 2021
# Author: Anton Gladky <gladk@debian.org>
# Test the fix for CVE-2021-38714

set -e


WORKDIR=$AUTOPKGTEST_TMP

# Build the minimal executable
gcc -I/usr/include/plib debian/tests/CVE-2021-38714.cxx -lplibssg -o $AUTOPKGTEST_TMP/CVE-2021-38714

# Test the server
echo "build: OK"

# Run the executable on normal image
$AUTOPKGTEST_TMP/CVE-2021-38714 debian/tests/OK.tga
echo "run 1: OK"

# Run the executable on poc
$AUTOPKGTEST_TMP/CVE-2021-38714 debian/tests/poc.tga
echo "run 2: OK"
