gpsd-dev
[Top][All Lists]
Advanced

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

✘nmea.lasttag


From: Gary E. Miller
Subject: ✘nmea.lasttag
Date: Tue, 7 Apr 2020 15:50:40 -0700

Yo All!

Ugh.  I found the problem with arm32 and test/daemon/bundg_zeus_9.log.
driver_nmea0183 now has more cycle enders than there are bits in a uint64_t.

Coverity spotted the bug as soon as the new NMEA sentences were added:


_____________________________________________________________________
*** CID 292260:  Integer handling issues  (BAD_SHIFT)
/driver_nmea0183.c: 3601 in nmea_parse()
3595                  (unsigned long long)session->nmea.cycle_enders);
3596         lasttag = session->nmea.lasttag;
3597         if (0 < session->nmea.lasttag) {
3598             lasttag_mask = (uint64_t)1 << lasttag;
3599         }
3600         if (0 < thistag) {
>>>     CID 292260:  Integer handling issues  (BAD_SHIFT)
>>>     In expression "1UL << thistag", left shifting by more than 63 bits has 
>>> undefined behavior.  The shift amount, "thistag", is as much as 70.  
3601             thistag_mask = (uint64_t)1 << thistag;
3602         }
3603         if (session->nmea.latch_frac_time) {
3604             timespec_t ts_delta;
3605             TS_SUB(&ts_delta, &session->nmea.this_frac_time,
3606                               &session->nmea.last_frac_time);
_____________________________________________________________________

Before I change the algorithm to a different method, create a new set of
bugs, can I just use uint128_t?  Or are there arches that do not have
uint128_t?

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpTdH3KHpiMV.pgp
Description: OpenPGP digital signature


reply via email to

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