audiovisualizer: shaders assume 32bpp
authorTim-Philipp Müller <tim@centricular.net>
Thu, 4 Apr 2013 23:49:46 +0000 (00:49 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Thu, 4 Apr 2013 23:53:54 +0000 (00:53 +0100)
Backport fix for crashes and invalid writes in totem from libvisual
in -base, to minimise differences to version in -base and to make
sure the bug doesn't sneak back in later when the base class is
made public.

The shader code looks like it makes assumptions that are not
necessarily always true, even if they're true for now for the
existing elements, namly that pixel stride is 4, for example.

See https://bugzilla.gnome.org/show_bug.cgi?id=683527

gst/audiovisualizers/gstaudiovisualizer.c

index 579b314..4bb9b08 100644 (file)
@@ -1151,8 +1151,10 @@ gst_audio_visualizer_chain (GstPad * pad, GstObject * parent,
       if (!klass->render (scope, inbuf, &outframe)) {
         ret = GST_FLOW_ERROR;
       } else {
-        /* run various post processing (shading and geometri transformation */
-        if (scope->shader) {
+        /* run various post processing (shading and geometric transformation) */
+        /* FIXME: SHADER assumes 32bpp */
+        if (scope->shader &&
+            GST_VIDEO_INFO_COMP_PSTRIDE (&scope->vinfo, 0) == 4) {
           scope->shader (scope, &outframe, &scope->tempframe);
         }
       }