krevis / MIDIApps

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

MIDI Monitor crash when saving, with events with host timestamps > Int64.max #98

Closed krevis closed 2 years ago

krevis commented 2 years ago

If an event has a timestamp, in nanoseconds, that is > Int64.max, MIDI Monitor will crash when saving the document.

This isn't very typical for normal timestamps, since the value is in nanoseconds since boot and Int64.max is 292 years. However, it's entirely possible that we see bogus timestamps, and we need to handle them without crashing.

(We have a UInt64 and construct an Int64 from it, then encode and decode the Int64, since there is no way to encode/decode a UInt64 with NSEncoder. The UInt64 value may be out the possible range of Int64, and Swift will crash if it is.)