Commit a7fde1c1 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

usb-audio: ignore usb packages with wrong size



usb packets with no payload (zero length) seem to happen in practice for
whatever reason.  Add a check and skip the packet then, otherwise we'll
trigger an assert.

Reported-by: default avatarLeonardo Soares Müller <leozinho29_eu@hotmail.com>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181211072649.20700-1-kraxel@redhat.com
parent 95a38c39
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -321,6 +321,9 @@ static int streambuf_put(struct streambuf *buf, USBPacket *p)
    if (!free) {
        return 0;
    }
    if (p->iov.size != USBAUDIO_PACKET_SIZE) {
        return 0;
    }
    assert(free >= USBAUDIO_PACKET_SIZE);
    usb_packet_copy(p, buf->data + (buf->prod % buf->size),
                    USBAUDIO_PACKET_SIZE);