vrend_renderer: check for 0 length shader request.

This is a follow up change for a5bfadaab5
to fix some request with 0 length shader. This moves the check from the
decode phase into create_shader as userspace may send 0
length shader in a long shader request.

TEST=webglaquarium
TEST=piglit opengl -t glsl --glsl

Reviewed-by: Dave Airlie <airlied@redhat.com>
macos/master
Po-Hsien Wang 6 years ago committed by Dave Airlie
parent 2546d11c63
commit 003007e3e4
  1. 4
      src/vrend_renderer.c

@ -3053,8 +3053,8 @@ int vrend_create_shader(struct vrend_context *ctx,
struct tgsi_token *tokens;
/* check for null termination */
int last_chunk_offset = sel->buf_offset ? sel->buf_offset : pkt_length * 4;
if (!memchr(shd_text + last_chunk_offset - 4, '\0', 4)) {
uint32_t last_chunk_offset = sel->buf_offset ? sel->buf_offset : pkt_length * 4;
if (last_chunk_offset < 4 || !memchr(shd_text + last_chunk_offset - 4, '\0', 4)) {
ret = EINVAL;
goto error;
}

Loading…
Cancel
Save