sanitizer: avoid divide-by-zero instances

Merges pull request #1094, with some minor changes. mpv expects IEEE,
and IEEE allows divisions by 0 for floats, so these shouldn't actually
be a problem, but do it anyway for the sake of clang.

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
Ben Boeckel
2014-09-14 14:35:56 -04:00
committed by wm4
parent e0b4daf3ad
commit 3f6212cd8d
3 changed files with 10 additions and 8 deletions

View File

@@ -573,7 +573,7 @@ static void update_uniforms(struct gl_video *p, GLuint program)
}
loc = gl->GetUniformLocation(program, "transform");
if (loc >= 0) {
if (loc >= 0 && p->vp_w > 0 && p->vp_h > 0) {
float matrix[3][3];
matrix_ortho2d(matrix, 0, p->vp_w, p->vp_h, 0);
gl->UniformMatrix3fv(loc, 1, GL_FALSE, &matrix[0][0]);