#! /bin/sh

# CVE-2021-33844
# A floating point exception (divide-by-zero) issue was discovered in SoX
# in function startread() of wav.c file. An attacker with a crafted wav file,
# could cause an application to crash.

# 14.4.2 i386:
# sox FAIL formats: can't open input file `bug1': Sorry, don't understand .wav size
# and address sanitizer reports no problems.

# 42b355 i386:
# Floating point exception (core dumped)

# Debian bookworm i386:
# sox FAIL formats: can't open input file `bug1': Sorry, don't understand .wav size

rm -f core

${sox:-sox} bug1 -n noiseprof /dev/null
status=$?

rm -f core out.wav

case "$status" in
0) status=255;;
2) status=0;;
esac

exit $status
