jack: protect against bad ports and buffers

This commit is contained in:
Wim Taymans 2021-08-25 11:54:41 +02:00
parent 11cb77c577
commit 999083105c

View file

@ -4087,6 +4087,9 @@ void * jack_port_get_buffer (jack_port_t *port, jack_nframes_t frames)
spa_return_val_if_fail(o != NULL, NULL); spa_return_val_if_fail(o != NULL, NULL);
if (o->type != INTERFACE_Port)
return NULL;
if ((p = o->port.port) == NULL) { if ((p = o->port.port) == NULL) {
struct mix *mix; struct mix *mix;
struct buffer *b; struct buffer *b;
@ -5711,7 +5714,7 @@ SPA_EXPORT
uint32_t jack_midi_get_event_count(void* port_buffer) uint32_t jack_midi_get_event_count(void* port_buffer)
{ {
struct midi_buffer *mb = port_buffer; struct midi_buffer *mb = port_buffer;
if (mb == NULL) if (mb == NULL || mb->magic != MIDI_BUFFER_MAGIC)
return 0; return 0;
return mb->event_count; return mb->event_count;
} }