opusenc: Sanitize sample rate, fix rate from AIFF
Fix errors (not affecting common values) in reading the sample rate from AIFF: the low 32 bits of the mantissa were incorrectly interpreted as signed, the first byte rather than first bit was being used as a sign, and non-integer rates were not properly rounded. Although the sample rate is validated prior to setting up the resampler, sample rates outside the range of an "int" could cause undefined behavior prior to that when cast from double to int for AIFF. Such rates could also be incorrect for WAV on 32-bit builds. Ensure that the rate is within the range of an int prior to casting.
Loading
Please register or sign in to comment