Commit 7febc002 authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Dave Airlie

vtest: be reasonable about cmd length

Avoid overflow, found thanks to AddressSanitizer & american fuzzy lop.
Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
parent 02e81fec
......@@ -26,6 +26,7 @@
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <limits.h>
#include "virglrenderer.h"
......@@ -228,6 +229,9 @@ int vtest_submit_cmd(uint32_t length_dw)
uint32_t *cbuf;
int ret;
if (length_dw > UINT_MAX / 4)
return -1;
cbuf = malloc(length_dw * 4);
if (!cbuf)
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment