[Python-modules-commits] r27061 - in packages/pyzmq/trunk/debian (3 files)

jtaylor-guest at users.alioth.debian.org jtaylor-guest at users.alioth.debian.org
Sat Jan 4 20:30:15 UTC 2014


    Date: Saturday, January 4, 2014 @ 20:30:14
  Author: jtaylor-guest
Revision: 27061

cython-error.patch: fix use-after-free due to wrong cython use

Added:
  packages/pyzmq/trunk/debian/patches/cython-error.patch
Modified:
  packages/pyzmq/trunk/debian/changelog
  packages/pyzmq/trunk/debian/patches/series

Modified: packages/pyzmq/trunk/debian/changelog
===================================================================
--- packages/pyzmq/trunk/debian/changelog	2014-01-04 20:30:10 UTC (rev 27060)
+++ packages/pyzmq/trunk/debian/changelog	2014-01-04 20:30:14 UTC (rev 27061)
@@ -2,6 +2,7 @@
 
   * New upstream release
     drop upstream applied workaround-gevent.patch
+  * cython-error.patch: fix use-after-free due to wrong cython use
   * provide pypy-zmq package
   * build package with pybuild
   * bump cython build depend version to required >= 0.16 (Closes: #721711)

Added: packages/pyzmq/trunk/debian/patches/cython-error.patch
===================================================================
--- packages/pyzmq/trunk/debian/patches/cython-error.patch	                        (rev 0)
+++ packages/pyzmq/trunk/debian/patches/cython-error.patch	2014-01-04 20:30:14 UTC (rev 27061)
@@ -0,0 +1,44 @@
+Description: fix possible use of deallocated object
+ __dealloc__ method might be called when the object is partially deleted, so
+ e.g. its methods must not be called. Fix this by copying the code of the
+ methods which require no object internals.
+Author: Julian Taylor <jtaylor.debian at googlemail.com>
+Bug: https://github.com/zeromq/pyzmq/issues/458
+
+--- a/zmq/backend/cython/context.pyx
++++ b/zmq/backend/cython/context.pyx
+@@ -94,7 +94,14 @@ cdef class Context:
+             free(self._sockets)
+             self._sockets = NULL
+             self._n_sockets = 0
+-        self.term()
++
++        if self.handle != NULL and not self.closed and getpid() == self._pid:
++            with nogil:
++                rc = zmq_ctx_destroy(self.handle)
++            _check_rc(rc)
++            self.handle = NULL
++            self.closed = True
++
+     
+     cdef inline void _add_socket(self, void* handle):
+         """Add a socket handle to be closed when Context terminates.
+diff --git a/zmq/backend/cython/utils.pyx b/zmq/backend/cython/utils.pyx
+index 0b318ee..43ed3d4 100644
+--- a/zmq/backend/cython/utils.pyx
++++ b/zmq/backend/cython/utils.pyx
+@@ -64,10 +64,9 @@ cdef class Stopwatch:
+         self.watch = NULL
+ 
+     def __dealloc__(self):
+-        try:
+-            self.stop()
+-        except ZMQError:
+-            pass
++        if self.watch:
++            zmq_stopwatch_stop(self.watch)
++            self.watch = NULL
+ 
+     def start(self):
+         """s.start()
+

Modified: packages/pyzmq/trunk/debian/patches/series
===================================================================
--- packages/pyzmq/trunk/debian/patches/series	2014-01-04 20:30:10 UTC (rev 27060)
+++ packages/pyzmq/trunk/debian/patches/series	2014-01-04 20:30:14 UTC (rev 27061)
@@ -1,2 +1,3 @@
 noncopysend-test.patch
 cffi-fix.patch
+cython-error.patch
\ No newline at end of file




More information about the Python-modules-commits mailing list