mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #34026 -- Fixed WKBReader.read() crash on string input.
This commit is contained in:
@@ -56,15 +56,17 @@ class GEOSIOTest(SimpleTestCase):
|
||||
# Creating a WKBReader instance
|
||||
wkb_r = WKBReader()
|
||||
|
||||
hex = b"000000000140140000000000004037000000000000"
|
||||
wkb = memoryview(binascii.a2b_hex(hex))
|
||||
ref = GEOSGeometry(hex)
|
||||
hex_bin = b"000000000140140000000000004037000000000000"
|
||||
hex_str = "000000000140140000000000004037000000000000"
|
||||
wkb = memoryview(binascii.a2b_hex(hex_bin))
|
||||
ref = GEOSGeometry(hex_bin)
|
||||
|
||||
# read() should return a GEOSGeometry on either a hex string or
|
||||
# a WKB buffer.
|
||||
g1 = wkb_r.read(wkb)
|
||||
g2 = wkb_r.read(hex)
|
||||
for geom in (g1, g2):
|
||||
g2 = wkb_r.read(hex_bin)
|
||||
g3 = wkb_r.read(hex_str)
|
||||
for geom in (g1, g2, g3):
|
||||
self.assertEqual(ref, geom)
|
||||
|
||||
bad_input = (1, 5.23, None, False)
|
||||
|
||||
Reference in New Issue
Block a user