Commit 5b726d32 authored by Kenneth Graunke's avatar Kenneth Graunke

run: Fix an off-by-one in realloc code.

We'd fill out shader_test[32767], increment shader_test_length to 32768,
then compare 32768 < 32768 and not bother to realloc.  This resulted in
an invalid memory write.  We'd realloc one entry later.
Reviewed-by: Matt Turner's avatarMatt Turner <mattst88@gmail.com>
parent f7f9e22f
......@@ -245,7 +245,7 @@ gather_shader_test(const char *fpath, const struct stat *sb, int typeflag)
return -1;
}
if (unlikely(shader_test_size < shader_test_length)) {
if (unlikely(shader_test_size <= shader_test_length)) {
shader_test_size *= 2;
shader_test = realloc(shader_test, shader_test_size * sizeof(struct shader_test));
}
......
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