[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [fluid-dev] Missing function fluid_midi_event_get_sysex
From: |
Tom M. |
Subject: |
Re: [fluid-dev] Missing function fluid_midi_event_get_sysex |
Date: |
Wed, 12 Oct 2022 17:54:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 |
I think I've seen this question already 4 years ago. I didn't know back then
why it was done that way, neither do I know now. I assumed that this function
wasn't made public because fluidsynth is not supposed to be a MIDI parser.
Particularly, there is an internal MIDI parser, but this one has a limited
buffer, causing potentially too long SysEx messages to be cut off:
https://github.com/FluidSynth/fluidsynth/blob/1fc6f0935bacc6fb3e38b7bebe8b24f6cf110dab/src/midi/fluid_midi.c#L2744-L2749
This "parser" may or may not be used depending on where the fluid_midi_event_t
is coming from.
I understand that there is a corresponding setter function
fluid_midi_event_set_sysex(), but unfortunately, this function is broken by
design: A dynamically malloc()ed and user provided buffer could be freed
internally by fluidsynth's version of free(). Allocating some data in one
domain, carrying it in a different domain and freeing it with different means
could lead to heap corruption, when two different memory runtimes are in use.
This is a common problem on Windows.
So my question would be, for what purpose you intend to use
fluid_midi_event_get_sysex()? And whether or not you would be happy only
getting the first 1024 bytes of the SysEx message?
Tom