diff options
author | Gary E. Miller <gem@rellim.com> | 2012-05-06 13:15:16 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2012-05-06 13:15:16 -0700 |
commit | 203729b88a7204e7d1e63991c882388ceb625c72 (patch) | |
tree | 19e77543d62b3ffe71b5f0929eac87b4d1236cd4 /geoid.c | |
parent | aee04a1b71a48fce168e9efedc51e282ddec0401 (diff) | |
download | gpsd-203729b88a7204e7d1e63991c882388ceb625c72.tar.gz |
Fix a segfault in geoid computation.
Problem found by: "Bywater, Rick (SA-1)" <rbywater@drs-ts.com>
Patch by: Beat Bolli <bbolli@ewanet.ch>
Diffstat (limited to 'geoid.c')
-rw-r--r-- | geoid.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -72,12 +72,9 @@ double wgs84_separation(double lat, double lon) ilon = (int)floor((180. + lon) / 10); /* sanity checks to prevent segfault on bad data */ - if ((ilat > 90) || (ilat < -90)) { - return 0.0; - } - if ((ilon > 180) || (ilon < -180)) { - return 0.0; - } + if ((GEOID_ROW <= ilat) || (0 > ilat) || + (GEOID_COL <= ilon) || (0 > ilon)) + return 0.0; ilat1 = ilat; ilon1 = ilon; |