summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-03-18 20:22:50 +0100
committerwm4 <wm4@nowhere>2017-03-18 20:22:50 +0100
commit03933f35641c65f502dc1e05ad8308e71a44d4fb (patch)
tree36ca379ae114aeed6ce7ee22721590a559d3fedf
parentc3248369ac501efb70f0142b909e85a19aed77d2 (diff)
downloadmpv-03933f35641c65f502dc1e05ad8308e71a44d4fb.tar.bz2
mpv-03933f35641c65f502dc1e05ad8308e71a44d4fb.tar.xz
vo_opengl: fix some undefined behavior
The gl_timer_last_us() function could access samples[-1]. Fix by coercing to unsigned, so the % will put it into index [0,max). The real value returned in this corner case doesn't mean too much, I guess.
-rw-r--r--video/out/opengl/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c
index 4fbe4053dc..9b01912041 100644
--- a/video/out/opengl/utils.c
+++ b/video/out/opengl/utils.c
@@ -1061,7 +1061,7 @@ void gl_sc_generate(struct gl_shader_cache *sc)
// How many samples to keep around, for the sake of average and peak
// calculations. This corresponds to a few seconds (exact time variable)
-#define QUERY_SAMPLE_SIZE 256
+#define QUERY_SAMPLE_SIZE 256u
struct gl_timer {
GL *gl;