Opened 15 years ago
Last modified 15 years ago
#11245 closed
contrib.gis.utils.GeoIP._check_query does not check for NULL pointer to _city or _country GeoIP libraries — at Version 3
Reported by: | andrewfox | Owned by: | jbronn |
---|---|---|---|
Component: | GIS | Version: | 1.0 |
Severity: | Keywords: | geodjango, gis, geoip, ctype | |
Cc: | andrewfox | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
In the _check_query method of geoip.py lines 344, 346, and 348 should not check self._city and/or self._country for 'is None' but instead for 'not self._city' or 'not self._country'. self._city and self._country are ctype wrapped pointers; so even if they returned NULL from the C library (e.g. fopen failure), self._city and self._country would still be not None but instead their pointer values would be None. Ctype checking for null pointers could be instead achieved by checking for 'not self._city'.
Referenced code (django/contrib/gis/utils/geoip.py (~line 344):
# Extra checks for the existence of country and city databases. if city_or_country and self._country is None and self._city is None: raise GeoIPException('Invalid GeoIP country and city data files.') elif country and self._country is None: raise GeoIPException('Invalid GeoIP country data file: %s' % self._country_file) elif city and self._city is None: raise GeoIPException('Invalid GeoIP city data file: %s' % self._city_file)
Change History (3)
comment:1 by , 15 years ago
Cc: | added |
---|
comment:2 by , 15 years ago
comment:3 by , 15 years ago
Component: | Contrib apps → GIS |
---|---|
Description: | modified (diff) |
Owner: | changed from | to
Lines actually 222, 224, and 226.