[retro-gtk] glsl-filter: Check the size of the shader sources
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] glsl-filter: Check the size of the shader sources
- Date: Thu, 16 Nov 2017 12:54:25 +0000 (UTC)
commit 2b337571a0bf861e454a434aab1b2a91840cddc0
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Nov 16 13:50:21 2017 +0100
glsl-filter: Check the size of the shader sources
This avoid failing a shader's compilation by overreading the source
string as it isn't NULL-terminated.
retro-gtk/retro-glsl-filter.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/retro-gtk/retro-glsl-filter.c b/retro-gtk/retro-glsl-filter.c
index 3476021..b82c0a4 100644
--- a/retro-gtk/retro-glsl-filter.c
+++ b/retro-gtk/retro-glsl-filter.c
@@ -239,11 +239,13 @@ create_shader (GBytes *source_bytes,
GLenum shader_type)
{
const gchar *source;
+ gint size;
GLuint shader;
source = g_bytes_get_data (source_bytes, NULL);
+ size = g_bytes_get_size (source_bytes);
shader = glCreateShader (shader_type);
- glShaderSource (shader, 1, &source, NULL);
+ glShaderSource (shader, 1, &source, &size);
glCompileShader (shader);
return shader;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]