FS#12163 - Fix AIFF on 64-bit systems

Attached to Project: Rockbox
Opened by Sean Bartell (wtachi) - Wednesday, 22 June 2011, 07:48 GMT
Last edited by Nils Wallménius (nls) - Saturday, 27 August 2011, 12:34 GMT
Task Type Patches
Category ID3 / meta data
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


There's a bug in get_long_be etc. in apps/metadata/metadata_common.c on 64-bit systems. An unsigned char is shifted left, so it's converted to an int, which can result in a negative value. This value is sign-extended to 64 bits when it's returned as an unsigned long. Changing the return type to uint32_t fixes the problem for now, although these functions should eventually be refactored.

This problem is unlikely to affect most formats, since they don't have values >0x7fffffff. The exception is AIFF, when it reads the file's frequency; this bug prevents 44100Hz AIFF files from being played.
This task depends upon

Closed by  Nils Wallménius (nls)
Saturday, 27 August 2011, 12:34 GMT
Reason for closing:  Accepted
Additional comments about closing:  committed, thanks
Comment by Sean Bartell (wtachi) - Wednesday, 17 August 2011, 16:59 GMT
Updated for new function in metadata_common.c.