krevis / MIDIApps

MIDI apps for Mac OS X: MIDI Monitor and SysEx Librarian.
http://www.snoize.com/
BSD 3-Clause "New" or "Revised" License
707 stars 113 forks source link

MIDI Monitor: timestamps can be inconsistent across save/open #99

Open krevis opened 2 years ago

krevis commented 2 years ago

When encoding and decoding message timestamps, there is potential for error in several ways.

krevis commented 2 years ago

To test: in MessageParser.swift in messagesForPacket(), change let timeStamp = packetPtr.pointee.timeStamp to something like MIDITimeStamp(Int64.max) + 1000. That gives us a timestamp which will certainly overflow when converting to nanoseconds, at least on an M1 where the ratio is 125/3.