]> git.alsa-project.org Git - alsa-lib.git/commitdiff
seq: Fix invalid sanity-check in snd_seq_set_input_buffer_size()
authorTakashi Iwai <tiwai@suse.de>
Sat, 4 Nov 2023 09:05:39 +0000 (10:05 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 4 Nov 2023 09:05:39 +0000 (10:05 +0100)
snd_seq_set_input_buffer_size() has an assert() call with packet_size,
but it's still uninitialized at that point.  Fix it with the real
packet size.

Fixes: 2aefb5c41cc0 ("seq: Add UMP support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/seq/seq.c

index fd8ca30e247238a89b768ce7430d4e0cc1f9d0de..5ec737a7004feb3e34e185ba186e1f5cd6315ef4 100644 (file)
@@ -1269,9 +1269,9 @@ int snd_seq_set_input_buffer_size(snd_seq_t *seq, size_t size)
        size_t packet_size;
 
        assert(seq && seq->ibuf);
+       packet_size = get_packet_size(seq);
        assert(size >= packet_size);
        snd_seq_drop_input(seq);
-       packet_size = get_packet_size(seq);
        size = (size + packet_size - 1) / packet_size;
        if (size != seq->ibufsize) {
                char *newbuf;