Fix reading maximum, nominal, minimum bitrate in _vorbis_unpack_info().
authorJörn Heusipp <osmanx@problemloesungsmaschine.de>
Sat, 22 Jul 2017 06:29:35 +0000 (08:29 +0200)
committerTimothy B. Terriberry <tterribe@xiph.org>
Sat, 22 Jul 2017 07:21:38 +0000 (00:21 -0700)
commit68ebc894325f56ae1d860d49626419cf66ea171b
tree88c3f0a152b58ba87e3915aac239e99f8e93acb5
parent679433ebb8287744a9801f847b7a105dbc2a0404
Fix reading maximum, nominal, minimum bitrate in _vorbis_unpack_info().

https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-630004.2.2 specifies
these fields as 32bit signed. oggpack_read(opb,32), which is used to
read these fields, returns 32 bits stored in a long. On architectures
where long is 64bit, this results in a positive value being returned.
This value is then stored in struct vorbis_info in bitrate_upper,
bitrate_nominal and bitrate_lower, also as long. ogginfo relies on
these values in order to display the respective header fields and thus
misrepresented the stored value -1 (which has the intended meaning of
"bitrate not set") as 2**32-1 on architectures where long is 64bit.

Explicitly cast the return value of oggpack_read() to a signed 32bit
integer type.

A nominal bitrate value of -1 is valid as per specification, and is
written by libvorbis for VBR files with samplerate >= 50000Hz.

Signed-off-by: Timothy B. Terriberry <tterribe@xiph.org>
lib/info.c