gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] wsg_separation Issue


From: Beat Bolli
Subject: Re: [gpsd-dev] wsg_separation Issue
Date: Sat, 05 May 2012 23:23:13 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

On 05.05.12 21:38, Gary E. Miller wrote:
> On Fri, 4 May 2012 09:51:38 -0400
> "Bywater, Rick (SA-1)" <address@hidden> wrote:
> 
>> I was running Coverity on gpsd-2.39 and it complained about an
>> array-bounds issue in geoid.c in the function wsg84_separation.
> 
> 2.39 is pretty ancient.  Can you repeat on a more current version?
> Preferably git head?

The current code is still wrong IMO:

    ilat = (int)floor((90. + lat) / 10);
    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;
    }

ilat and ilon are offset so as to be >= 0, but the subsequent test
checks the original degree range without offset or divisor. Checking lat
and lon above the i{lat,lon} calculation should work.

Regards,
Beat
-- 
mail: echo '<address@hidden>' | tr -d '[A-S]'
pgp: 0x506A903A; 49D5 794A EA77 F907 764F  D89E 304B 93CF 506A 903A
gsm: 4.7.7.6.0.7.7.9.7.1.4.e164.arpa
icbm: 47.0452 N, 7.2715 E

"It takes love over gold, and mind over matter" -- Dire Straits

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]