Menu

#37 fix crash when importing python module

Unstable_(example)
open
nobody
None
5
2014-07-30
2013-11-27
No

the python code does:

static PyGetSetDef imagescanner_getset[] = {
    { "results", (getter)imagescanner_get_results, },
};

that lacks a trailing sentinel. that means if the structure doesn't happen to just have zeroed data following it, python will walk random memory trying to load them. on x86, it seems the default padding/whatever happens to include zero bytes, so it doesn't crash. but on arm, the data is packed tighter and python crashes.

Debian has an example report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702499

simple fix:

--- a/python/imagescanner.c
+++ b/python/imagescanner.c
@@ -68,6 +68,7 @@ imagescanner_get_results (zbarImageScanner *self,

 static PyGetSetDef imagescanner_getset[] = {
     { "results", (getter)imagescanner_get_results, },
+    { NULL },
 };

 static PyObject*

Discussion

  • Alex Margolin

    Alex Margolin - 2014-07-12

    Too bad I didn't see this comment - took me a few hours to reach the same solution. :(

     
  • eileen

    eileen - 2014-07-30

    It this issue going to get resolved in the main repo? I ran into the same problem and took me way too long to find the solution.

     

Log in to post a comment.