alsa-lib/src/seq
Takashi Iwai 7c5c050090 seq: Fix signedness in MIDI encoder/decoder
The qlen field of struct snd_midi_event was declared as size_t while
status_events[] assigns the qlen to -1 indicating to skip.  This leads
to the misinterpretation since size_t is unsigned, hence it passes the
check "dev.qlen > 0" incorrectly in snd_midi_event_encode_byte(),
which eventually results in a memory corruption.

Also, snd_midi_event_decode() doesn't consider about a negative qlen
value and tries to copy the size as is.

This patch fixes these issues: the first one is addressed by simply
replacing size_t with ssize_t in snd_midi_event struct.  For the
latter, a check "qlen <= 0" is added to bail out; this is also good as
a slight optimization.

Reported-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-23 08:34:37 +02:00
..
Makefile.am autotools: update style 2014-02-26 08:16:22 +01:00
seq.c core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
seq_event.c Remove sequencer instrument layer 2007-10-30 12:31:55 +01:00
seq_hw.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
seq_local.h Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
seq_midi_event.c seq: Fix signedness in MIDI encoder/decoder 2018-08-23 08:34:37 +02:00
seq_old.c Remove sequencer instrument layer 2007-10-30 12:31:55 +01:00
seq_symbols.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
seqmid.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00