vo_opengl: fix out-of-bounds read in update_uniform

Since the addition of UBOs, the assumption that the uniform index
corresponds to the pass->params.inputs index is no longer true. Also,
there's no reason it would even need this - since the `input` is also
available directly in sc_uniform.

I have no idea how I've been using this code for as long as I have
without any segfaults until earlier today.
This commit is contained in:
Niklas Haas 2017-09-11 01:02:56 +02:00
parent 1da53248ab
commit 0fe4a492c4
No known key found for this signature in database
GPG Key ID: 9A09076581B27402
1 changed files with 1 additions and 2 deletions

View File

@ -491,8 +491,7 @@ static void update_uniform(struct gl_shader_cache *sc, struct sc_entry *e,
struct sc_uniform *u, int n)
{
struct sc_cached_uniform *un = &e->cached_uniforms[n];
struct ra_renderpass_input *input = &e->pass->params.inputs[n];
size_t size = ra_render_pass_input_data_size(input);
size_t size = ra_render_pass_input_data_size(&u->input);
bool changed = true;
if (size > 0)
changed = memcmp(&un->v, &u->v, size) != 0;