AP_Math: Update location_sanitize to sanitize for lat/lng

This commit is contained in:
Michael du Breuil 2016-04-11 14:06:03 -07:00
parent 62574b35b5
commit bb7cf6c0b6
1 changed files with 8 additions and 0 deletions

View File

@ -259,6 +259,14 @@ bool location_sanitize(const struct Location &defaultLoc, struct Location &loc)
loc.alt = defaultLoc.alt;
has_changed = true;
}
// limit lat/lng to appropriate ranges
if (abs(loc.lat) > 90 * 1e7 || abs(loc.lng) > 180 * 1e7) {
loc.lat = defaultLoc.lat;
loc.lng = defaultLoc.lng;
has_changed = true;
}
return has_changed;
}