fluid synth's sample pitchadj signed char value incorrectly read on ARM cpus, causing incorrectly-pitched synthesis

• Jul 5, 2019 - 00:28
Reported version
3.2
Type
Functional
Frequency
Many
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project

ARM cpu's do not presume that a "char" is signed, unless explicitly called a "signed char". This causes problems, because on x86 machines, a "char" is presumed to be signed. There have been a few other spots in code where a char is presumed to be signed but not explicitly declared as signed.

Issue reported as: https://musescore.org/en/node/291747

This specific problem is due to fluid synth's integer sample->pitchadj being read from the file as a unspecified char, when it must be read as a signed char to preserve sign.


Comments

Status PR created fixed

Fixed in branch master, commit 4253d779cf

_fix #291756 explicitly-signed char fluid pitchadj

C standards say that "char" may either be a "signed char" or "unsigned char" but that it is up to the compilers implementation or the platform which is followed. Some non x86 platforms, including PowerPC and ARM, treat unspecified chars as unsigned chars, so it is necessary to explicitly declare them as "signed char" (or to compile with "--signed_chars").

This fix ensures that fluid synth's sample's pitchadj value are correctly read as signed._

Fix version
3.3.0