-
Notifications
You must be signed in to change notification settings - Fork 136
Closed
Description
Issue details
The struct definition for MIDIPacketList is wrong and only seems to work by accident on 32bit platforms.
When calling getPacket() on a MIDIPacketList struct the returned packet is off by 4 byte on a 64bit platform.
Example:
On 32bit
- Pointer of list:
6106767000 - Pointer of
getPacket().getHandle():6106767004
On 64bit
- Pointer of list:
6106767000 - Pointer of
getPacket().getHandle():6106767008
Therefore all the data of the MIDIPacket is invalid on 64bit platforms.
The issue is that the packet is not referenced by ref in the original header - therefore the offset is always 4 byte (the numPackets field)
Reproduction steps/code
- Receive midi data using CoreMidi
- The length of any midi packet is way too long on 64bit platforms which shows the off by 4.
Configuration
Build Tools:
- Gradle plugin
Versions:
- Robovm: 2.3.7-SNAPSHOT
- XCode: 10.2.1
- JDK: 1.8.0_181
Build Targets:
iPhone 8 (64 bit)
Workaround
As of now I'm reading the packet with an hardcoded 4 byte offset but that's pretty ugly..
long listPointer = pktlist.getHandle();
MIDIPacket packet = MIDIPacket.toStruct(MIDIPacket.class, listPointer + 4);
Metadata
Metadata
Assignees
Labels
No labels