[vlc-commits] vout: opengl: converter: prevent FPE with cropped empty spu

Francois Cartegnie git at videolan.org
Wed Jul 17 14:06:03 CEST 2019


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Aug 29 11:07:38 2018 +0200| [6828c739026cc046a9576751439568269bfb58aa] | committer: Hugo Beauzée-Luyssen

vout: opengl: converter: prevent FPE with cropped empty spu

(cherry picked from commit 90989df9e3aab300c2d09a8eb9c0570e4cba4efa)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=6828c739026cc046a9576751439568269bfb58aa
---

 modules/video_output/opengl/converter_sw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/opengl/converter_sw.c b/modules/video_output/opengl/converter_sw.c
index e48b800573..4e510bcd07 100644
--- a/modules/video_output/opengl/converter_sw.c
+++ b/modules/video_output/opengl/converter_sw.c
@@ -234,7 +234,7 @@ tc_pbo_update(const opengl_tex_converter_t *tc, GLuint *textures,
         tc->vt->BindTexture(tc->tex_target, textures[i]);
 
         tc->vt->PixelStorei(GL_UNPACK_ROW_LENGTH, pic->p[i].i_pitch
-                                * tex_width[i] / pic->p[i].i_visible_pitch);
+                                * tex_width[i] / (pic->p[i].i_visible_pitch ?: 1));
 
         tc->vt->TexSubImage2D(tc->tex_target, 0, 0, 0, tex_width[i], tex_height[i],
                               tc->texs[i].format, tc->texs[i].type, NULL);
@@ -493,7 +493,7 @@ upload_plane(const opengl_tex_converter_t *tc, unsigned tex_idx,
     }
     else
     {
-        tc->vt->PixelStorei(GL_UNPACK_ROW_LENGTH, pitch * width / visible_pitch);
+        tc->vt->PixelStorei(GL_UNPACK_ROW_LENGTH, pitch * width / (visible_pitch ?: 1));
         tc->vt->TexSubImage2D(tc->tex_target, 0, 0, 0, width, height,
                               tex_format, tex_type, pixels);
     }



More information about the vlc-commits mailing list