zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mic...@apache.org
Subject svn commit: r1583784 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/contrib/zkpython/src/c/zookeeper.c src/contrib/zkpython/src/test/get_set_test.py
Date Tue, 01 Apr 2014 21:00:47 GMT
Author: michim
Date: Tue Apr  1 21:00:46 2014
New Revision: 1583784

URL: http://svn.apache.org/r1583784
Log:
ZOOKEEPER-1906. zkpython: invalid data in GetData for empty node (Nikita Vetoshkin via michim)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/contrib/zkpython/src/c/zookeeper.c
    zookeeper/branches/branch-3.4/src/contrib/zkpython/src/test/get_set_test.py

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1583784&r1=1583783&r2=1583784&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Tue Apr  1 21:00:46 2014
@@ -11,6 +11,9 @@ BUGFIXES:
   ZOOKEEPER-1901. [JDK8] Sort children for comparison in AsyncOps tests
   (Andrew Purtell via michim)
 
+  ZOOKEEPER-1906. zkpython: invalid data in GetData for empty node
+  (Nikita Vetoshkin via michim)
+
 
 Release 3.4.6 - 2014-03-10 
 

Modified: zookeeper/branches/branch-3.4/src/contrib/zkpython/src/c/zookeeper.c
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/contrib/zkpython/src/c/zookeeper.c?rev=1583784&r1=1583783&r2=1583784&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/contrib/zkpython/src/c/zookeeper.c (original)
+++ zookeeper/branches/branch-3.4/src/contrib/zkpython/src/c/zookeeper.c Tue Apr  1 21:00:46
2014
@@ -1223,7 +1223,7 @@ static PyObject *pyzoo_get(PyObject *sel
   }
 
   PyObject *stat_dict = build_stat( &stat );
-  PyObject *ret = Py_BuildValue( "(s#,N)", buffer,buffer_len, stat_dict );
+  PyObject *ret = Py_BuildValue( "(s#,N)", buffer,buffer_len < 0 ? 0 : buffer_len, stat_dict
);
   free(buffer);
 
   return ret;

Modified: zookeeper/branches/branch-3.4/src/contrib/zkpython/src/test/get_set_test.py
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/contrib/zkpython/src/test/get_set_test.py?rev=1583784&r1=1583783&r2=1583784&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/contrib/zkpython/src/test/get_set_test.py (original)
+++ zookeeper/branches/branch-3.4/src/contrib/zkpython/src/test/get_set_test.py Tue Apr  1
21:00:46 2014
@@ -32,6 +32,19 @@ class GetSetTest(zktestbase.TestBase):
         except:
             pass
 
+    def test_empty_node(self):
+        """
+        Test for a bug when instead of empty string we can get
+        random data from buffer malloc'ed to hold node contents.
+        See ZOOKEEPER-1906 for details
+        """
+        NODE_PATH = "/zk-python-test-empty-node"
+        self.ensureDeleted(NODE_PATH)
+        zookeeper.create(self.handle, NODE_PATH, "",
+                         [{"perms":0x1f, "scheme":"world", "id" :"anyone"}])
+        (data,stat) = zookeeper.get(self.handle, NODE_PATH, None)
+        self.assertEqual(data, "", "Data is not empty as expected: " + data)
+
     def test_sync_getset(self):
         self.assertEqual(self.connected, True, "Not connected!")
         (data,stat) = zookeeper.get(self.handle, "/zk-python-getsettest", None)



Mime
View raw message