From 0659f264aa5cdce46b71a05fb201c8cacf83aa8d Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 20 Jul 2026 17:25:57 -0400 Subject: [PATCH] VOR Localizer: initialize intersection variables Initialize the coordinate and bearing variables used by VORModel::findIntersection() and declare the validity flags as bool. Coverity reported that lat1, lon1, bearing1, lat2, lon2, and bearing2 could be passed uninitialized to calcIntersectionPoint(). While the current control flow is intended to assign these values before the corresponding validity flag is set, they were not initialized at declaration, leaving undefined behavior if that invariant were ever broken. Initializing the variables removes the possibility of using indeterminate values, satisfies static analysis, and makes the code more robust against future modifications. The validity flags are also changed from float to bool to match their intended use. Signed-off-by: Robin Getz --- plugins/feature/vorlocalizer/vorlocalizergui.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/feature/vorlocalizer/vorlocalizergui.cpp b/plugins/feature/vorlocalizer/vorlocalizergui.cpp index 17734a04a..02b4172d1 100644 --- a/plugins/feature/vorlocalizer/vorlocalizergui.cpp +++ b/plugins/feature/vorlocalizer/vorlocalizergui.cpp @@ -304,8 +304,10 @@ bool VORModel::findIntersection(float &lat, float &lon) { if (m_vors.count() > 2) { - float lat1, lon1, bearing1, valid1 = false; - float lat2, lon2, bearing2, valid2 = false; + float lat1 = 0.0f, lon1 = 0.0f, bearing1 = 0.0f; + bool valid1 = false; + float lat2 = 0.0f, lon2 = 0.0f, bearing2 = 0.0f; + bool valid2 = false; for (int i = 0; i < m_vors.count(); i++) {