Commit f97a5741 authored by Justin Bronn's avatar Justin Bronn
Browse files

Fixed #16864 -- WKT regex now allows negative SRIDs. Thanks, Marcel Dancak...

Fixed #16864 -- WKT regex now allows negative SRIDs.  Thanks, Marcel Dancak for bug report and initial patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16843 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 00678334
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import re
# to prevent potentially malicious input from reaching the underlying C
# library.  Not a substitute for good Web security programming practices.
hex_regex = re.compile(r'^[0-9A-F]+$', re.I)
wkt_regex = re.compile(r'^(SRID=(?P<srid>\d+);)?'
wkt_regex = re.compile(r'^(SRID=(?P<srid>\-?\d+);)?'
                       r'(?P<wkt>'
                       r'(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)'
                       r'[ACEGIMLONPSRUTYZ\d,\.\-\(\) ]+)$',
+8 −7
Original line number Diff line number Diff line
@@ -182,7 +182,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin):

    def test01h_ewkt(self):
        "Testing EWKT."
        srid = 32140
        srids = (-1, 32140)
        for srid in srids:
            for p in self.geometries.polygons:
                ewkt = 'SRID=%d;%s' % (srid, p.wkt)
                poly = fromstr(ewkt)