diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2018-12-11 08:26:49 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-01-10 09:56:19 +0100 |
commit | a7fde1c1706a93c304eb301cc290d71c9426493b (patch) | |
tree | 96de622f1ad002db04038b4767996f3ba0690241 /hw/usb/dev-audio.c | |
parent | 95a38c395de8941ee0f3de09006c423773e093b7 (diff) | |
download | qemu-a7fde1c1706a93c304eb301cc290d71c9426493b.zip qemu-a7fde1c1706a93c304eb301cc290d71c9426493b.tar.gz qemu-a7fde1c1706a93c304eb301cc290d71c9426493b.tar.bz2 |
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: Leonardo Soares Müller <leozinho29_eu@hotmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181211072649.20700-1-kraxel@redhat.com
Diffstat (limited to 'hw/usb/dev-audio.c')
-rw-r--r-- | hw/usb/dev-audio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index ee43e49..28ac7c5 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -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); |