#! /bin/sh

# CVE-2022-31650
# In SoX 14.4.2, there is a floating-point exception in lsx_aiffstartwrite
# in aiff.c in libsox.a.

# 14.4.2
# Floating point exception (core dumped)

# Debian bookworm i386
# sox FAIL formats: can't open input file `poc_fpe_lsx_aiffstartwrite': implausibly large number of channels
# end exits 2

# 42b355
# Floating point exception (core dumped)

rm -f core

${sox:-sox} --single-threaded poc_fpe_lsx_aiffstartwrite -t aiff /dev/null
status=$?

rm -f core

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

exit $status
