gl: prevent division by 0 on unsupported texture type

Coverity 1199697
This commit is contained in:
Vincent Penquerc'h 2014-04-21 09:47:08 +01:00
parent b2fe0c50ff
commit 6ec86ca1dc

View file

@ -350,7 +350,11 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
gl_mem->unpack_length = 1;
n_gl_bytes = _gl_texture_type_n_bytes (gl_mem->tex_type);
if (n_gl_bytes == 0) {
GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Unsupported texture type %d",
gl_mem->tex_type);
return;
}
#if GST_GL_HAVE_OPENGL || GST_GL_HAVE_GLES3
if (USING_OPENGL (gl_mem->context) || USING_GLES3 (gl_mem->context)) {
gl_mem->unpack_length = gl_mem->stride / n_gl_bytes;