#! /bin/sh

# https://sourceforge.net/p/sox/bugs/367
# We found a heap-buffer-overflow in SoX 14.4.3git (src/formats_i.c:98:16)

# 14.4.2
# malloc(): corrupted top size
# Aborted (core dumped)

# 42b355, Debian, sox_ng-14.5.0, 14.5.0.3 with address sanitizer
# sox FAIL formats: can't open input file `poc_file': Implausible dictionary size in HCOM header

# 42b355 with address sanitizer:
# AddressSanitizer: heap-buffer-overflow

# sox_ng-14.5.0+git 36dee3  2025-02-09
# sox_ng FAIL formats: can't open input file `poc_file': Implausible dictionary size in HCOM header

rm -f core

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

rm -f core

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

exit $status
