mirror of https://github.com/mpv-player/mpv
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:
parent
1da53248ab
commit
0fe4a492c4
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue