summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-09-11 01:02:56 +0200
committerNiklas Haas <git@haasn.xyz>2017-09-11 01:04:08 +0200
commit0fe4a492c431610dc69b66eb4397707bda178b99 (patch)
tree60827f100702f005da061ad4c7e5d39651331a8c /video
parent1da53248ab29d711df5602f3fdff90c45298ec77 (diff)
downloadmpv-0fe4a492c431610dc69b66eb4397707bda178b99.tar.bz2
mpv-0fe4a492c431610dc69b66eb4397707bda178b99.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/shader_cache.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/video/out/opengl/shader_cache.c b/video/out/opengl/shader_cache.c
index 0a722b8492..e702d7e4a1 100644
--- a/video/out/opengl/shader_cache.c
+++ b/video/out/opengl/shader_cache.c
@@ -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;