After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 702844 - glshader element crash
glshader element crash
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-gl
0.10.3
Other Linux
: Normal normal
: 0.10.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-22 02:34 UTC by comicfans44
Modified: 2013-06-27 23:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description comicfans44 2013-06-22 02:34:12 UTC
in file gstglfiltershader.c 
when loading shader file ,it should pass "r"(for fopen) instead of O_RDONLY (for open) ,this leads a crash when using glshader element. and here's a quick fix.  


--- a/gst/gl/gstglfiltershader.c 2012-05-08 12:43:19.000000000 +0800
+++ b/gst/gl/gstglfiltershader.c 2013-06-20 15:49:52.639081794 +0800
@@ -263,7 +263,7 @@
 
   // read the filter from file
   GST_INFO ("loading file: %s", filename);
-  f = fopen (filename, O_RDONLY);
+  f = fopen (filename, "r");
   if (f == NULL) {
     GST_ERROR ("could not open file: %s", filename);
     return -1;
Comment 1 Tim-Philipp Müller 2013-06-22 22:41:33 UTC
Thanks, any chance you could tell us your name so we can attribute the patches to you properly?
Comment 2 comicfans44 2013-06-24 00:28:35 UTC
王昕宇 or wangxinyu or comicfans44 ,any one is OK ,Thank you
Comment 3 Tim-Philipp Müller 2013-06-27 23:12:24 UTC
Thanks, should be fixed by this as well (if not, please re-open):


commit 8cbd495b5e71ef9a8604749e8c03190d6d314138
Author: Tim-Philipp Müller <tim@centricular.net>
Date:   Fri Jun 28 00:04:43 2013 +0100

    glfiltershader: fix crash when loading shader file
    
    Just use g_file_get_contents() instead of home-made file loading.
    Fixes two issues - one is that we should pass "r" to fopen and
    not O_RDONLY, the other is that an incorrect variable was used
    to read the file length, leading to an empty shader file.
    
    Spotted by: Wang Xin-yu (王昕宇) <comicfans44@gmail.com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702844
    https://bugzilla.gnome.org/show_bug.cgi?id=702845
    
    Conflicts:
        gst/gl/gstglfiltershader.c