jack: copy events to right offset

The larger events need to be copied into the target buffer at the same
offset as the source buffer or else we overwrite the header and make
a corrupt buffer.
This commit is contained in:
Wim Taymans 2024-05-10 12:15:36 +02:00
parent 89edb9f6c5
commit cdc150a2c3

View file

@ -5356,7 +5356,7 @@ static void *get_buffer_input_midi(struct port *p, jack_nframes_t frames)
* sizeof(struct midi_event)));
if (mb->write_pos) {
size_t offs = mb->buffer_size - 1 - mb->write_pos;
memcpy(ptr, SPA_PTROFF(mb, offs, void), mb->write_pos);
memcpy(SPA_PTROFF(ptr, offs, void), SPA_PTROFF(mb, offs, void), mb->write_pos);
}
return ptr;
}