derekf pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=e6f17dee5d6ae504b4565afc7e5f9033cd597e22

commit e6f17dee5d6ae504b4565afc7e5f9033cd597e22
Author: Derek Foreman <[email protected]>
Date:   Thu Jun 22 14:05:24 2017 -0500

    Clear the native surface structure before initializing it
    
    Since the native surface "API" is isomorphic with pain and suffering, we
    should be extra careful when we touch it.
---
 src/bin/e_pixmap.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c
index 29f8529b2..0ddd646b9 100644
--- a/src/bin/e_pixmap.c
+++ b/src/bin/e_pixmap.c
@@ -703,6 +703,17 @@ e_pixmap_native_surface_init(E_Pixmap *cp, 
Evas_Native_Surface *ns)
    EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ns, EINA_FALSE);
 
+   /* This structure is stack automatic in the caller, so it's all
+    * uninitialized. Clear it to 0 so we don't have uninit data for
+    * variables only present in a newer version of native surface
+    * than this code was written for.
+    *
+    * The other option would be to set ns->version to whatever version
+    * this code was actually written against, but I've been told all
+    * native surface users are expected to set ns->version to the
+    * version provided in the headers (EVAS_NATIVE_SURFACE_VERSION)
+    */
+   memset(ns, 0, sizeof(*ns));
    ns->version = EVAS_NATIVE_SURFACE_VERSION;
    switch (cp->type)
      {

-- 


Reply via email to