From 2dfd79d45c96dce9b2336a83bdb1b0b2304d87d2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 5 Nov 2023 10:14:36 +0100 Subject: [PATCH] Avoid potential undefined behaviour detected by Coverity Scan --- .../observables/gnuradio_blocks/hybrid_observables_gs.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index d32f0ba68..8569dde24 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -431,6 +431,10 @@ bool hybrid_observables_gs::interp_trk_obs(Gnss_Synchro &interpolated_obs, uint3 // 1st: copy the nearest gnss_synchro data for that channel interpolated_obs = d_gnss_synchro_history->get(ch, nearest_element); + if (interpolated_obs.fs == 0LL) + { + return false; + } // 2nd: Linear interpolation: y(t) = y(t1) + (y(t2) - y(t1)) * (t - t1) / (t2 - t1) const double T_rx_s = static_cast(rx_clock) / static_cast(interpolated_obs.fs);