Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue 239: Memory error reading SQL Server XML 4K

  • Loading branch information...
commit 66c51365b2a2283a0742ca9cab771f3362a9fbb8 1 parent 554f26f
@mkleehammer authored
Showing with 22 additions and 2 deletions.
  1. +1 −2  src/getdata.cpp
  2. +21 −0 tests2/sqlservertests.py
View
3  src/getdata.cpp
@@ -174,14 +174,13 @@ class DataBuffer
return false;
buffer = PyByteArray_AS_STRING(bufferOwner);
}
-#else
+#endif
else if (bufferOwner && PyBytes_CheckExact(bufferOwner))
{
if (_PyBytes_Resize(&bufferOwner, newSize) == -1)
return false;
buffer = PyBytes_AS_STRING(bufferOwner);
}
-#endif
else
{
char* tmp = (char*)realloc(buffer, (size_t)newSize);
View
21 tests2/sqlservertests.py
@@ -393,6 +393,27 @@ def test_text_upperlatin(self):
self._test_strliketype('text', 'á')
#
+ # xml
+ #
+
+ # def test_empty_xml(self):
+ # self._test_strliketype('xml', bytearray(''))
+
+ def test_null_xml(self):
+ self._test_strliketype('xml', None, type(None))
+
+ # Generate a test for each fencepost size: test_unicode_0, etc.
+ def _maketest(value):
+ def t(self):
+ self._test_strliketype('xml', value)
+ return t
+ for value in ANSI_FENCEPOSTS:
+ locals()['test_xml_buffer_%s' % len(value)] = _maketest(value)
+
+ def test_xml_upperlatin(self):
+ self._test_strliketype('xml', 'á')
+
+ #
# bit
#
Please sign in to comment.
Something went wrong with that request. Please try again.