chriscant / PhotoGridRef

Get GB or Irish grid reference from JPG photo GPS information
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Potentially uninitialised variable `nu` #1

Open andyjohnson0 opened 3 months ago

andyjohnson0 commented 3 months ago

In os_cartesian_to_lat_lon() (os_coord_transform.c::54) the value of nu is potentially uninitialised before use on line 64 if the while loop at line 55 is not entered.

chriscant commented 3 months ago

I can see that this potentially an issue, which appears in the code I've used from https://github.com/mossblaser/os_coord which hasn't changed in 11 years. This in turn was based on another repository by Chris Veness. The latest relevant code is at https://github.com/chrisveness/geodesy/blob/master/osgridref.js#L89

I don't know the algorithm being used. The lat_lon.eh value being set is the Ellipsoidal height which I don't knowingly use. I imagine that nu could be initialised to zero and that would be fine.