From f5d88a4b6a35303da79486af03e6b0dcfeefaa5c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Apr 2022 18:27:11 +0200 Subject: [PATCH 1/4] bugfix for inverse copying --- scripts/q7s-cp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/q7s-cp.py b/scripts/q7s-cp.py index 3df6d662..9bc18201 100755 --- a/scripts/q7s-cp.py +++ b/scripts/q7s-cp.py @@ -92,7 +92,7 @@ def build_cmd(args): else: target = args.target if args.invert: - cmd += f"{port_args} {address}:{args.source} {target}" + cmd += f"{port_args} {address}:{source_files} {target}" else: cmd += f"{port_args} {source_files} {address}:{target}" return cmd From 1fb5b48455a7315fd77711dbd6c9260e017ed619 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Apr 2022 17:18:31 +0200 Subject: [PATCH 2/4] fix initializer list order --- mission/devices/IMTQHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index 2b3ba240..ad6beb0a 100644 --- a/mission/devices/IMTQHandler.cpp +++ b/mission/devices/IMTQHandler.cpp @@ -10,7 +10,6 @@ IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, power::Switch_t pwrSwitcher) : DeviceHandlerBase(objectId, comIF, comCookie), - switcher(pwrSwitcher), engHkDataset(this), calMtmMeasurementSet(this), rawMtmMeasurementSet(this), @@ -19,7 +18,8 @@ IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comC posYselfTestDataset(this), negYselfTestDataset(this), posZselfTestDataset(this), - negZselfTestDataset(this) { + negZselfTestDataset(this), + switcher(pwrSwitcher) { if (comCookie == NULL) { sif::error << "IMTQHandler: Invalid com cookie" << std::endl; } From 850722eae5a5f47bc6e9fa35ec5a7e3bedf72c00 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Apr 2022 17:24:04 +0200 Subject: [PATCH 3/4] include improvements --- bsp_q7s/core/CoreController.cpp | 2 +- bsp_q7s/core/obsw.cpp | 2 +- watchdog/Watchdog.cpp | 2 +- watchdog/definitions.h | 2 ++ watchdog/watchdogConf.h.in | 2 -- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 42ba4307..73fd49bb 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -8,7 +8,7 @@ #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/timemanager/Stopwatch.h" #include "fsfw/version.h" -#include "watchdogConf.h" +#include "watchdog/definitions.h" #if OBSW_USE_TMTC_TCP_BRIDGE == 0 #include "fsfw/osal/common/UdpTmTcBridge.h" #else diff --git a/bsp_q7s/core/obsw.cpp b/bsp_q7s/core/obsw.cpp index 27d1484e..359d04c2 100644 --- a/bsp_q7s/core/obsw.cpp +++ b/bsp_q7s/core/obsw.cpp @@ -8,7 +8,7 @@ #include "OBSWVersion.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/version.h" -#include "watchdogConf.h" +#include "watchdog/definitions.h" static int OBSW_ALREADY_RUNNING = -2; diff --git a/watchdog/Watchdog.cpp b/watchdog/Watchdog.cpp index 9ae60548..a14bae53 100644 --- a/watchdog/Watchdog.cpp +++ b/watchdog/Watchdog.cpp @@ -1,5 +1,5 @@ #include "Watchdog.h" -#include "watchdogConf.h" +#include "definitions.h" #include #include diff --git a/watchdog/definitions.h b/watchdog/definitions.h index 991de54d..bfb1ec13 100644 --- a/watchdog/definitions.h +++ b/watchdog/definitions.h @@ -1,6 +1,8 @@ #ifndef WATCHDOG_DEFINITIONS_H_ #define WATCHDOG_DEFINITIONS_H_ +#include + namespace watchdog { // Suspend watchdog operations temporarily diff --git a/watchdog/watchdogConf.h.in b/watchdog/watchdogConf.h.in index b1b9956b..41bebe72 100644 --- a/watchdog/watchdogConf.h.in +++ b/watchdog/watchdogConf.h.in @@ -1,8 +1,6 @@ #include #include -#include "watchdog/definitions.h" - #define WATCHDOG_VERBOSE_LEVEL 1 /** * This flag instructs the watchdog to create a special file in /tmp if the OBSW is running From 9c54696d917e101ec41e2eeaaa2af1c194e791b9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 21 Apr 2022 10:25:51 +0200 Subject: [PATCH 4/4] fix out-of-bounds read --- mission/devices/PCDUHandler.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index bc302bac..1a31e608 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -81,12 +81,16 @@ ReturnValue_t PCDUHandler::initialize() { void PCDUHandler::initializeSwitchStates() { using namespace pcdu; - for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { - if (idx < PDU::CHANNELS_LEN) { - switchStates[idx] = INIT_SWITCHES_PDU1[idx]; - } else { - switchStates[idx] = INIT_SWITCHES_PDU2[idx]; + try { + for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { + if (idx < PDU::CHANNELS_LEN) { + switchStates[idx] = INIT_SWITCHES_PDU1.at(idx); + } else { + switchStates[idx] = INIT_SWITCHES_PDU2.at(idx - PDU::CHANNELS_LEN); + } } + } catch (const std::out_of_range& err) { + sif::error << "PCDUHandler::initializeSwitchStates: " << err.what() << std::endl; } }