From 5a5445e98093d6cd0e3a9d6b3e039c897a1348b3 Mon Sep 17 00:00:00 2001 From: gullradriel <3157857+gullradriel@users.noreply.github.com> Date: Wed, 7 Jun 2023 11:25:35 +0200 Subject: [PATCH] Dsp fatfs fix (#1118) * fixing overflow by one in ../firmware/baseband/dsp_goertzel.cpp by expanding the original array size * fix underflow by -1 if seq is not stopping the loop --- firmware/baseband/dsp_goertzel.hpp | 2 +- firmware/chibios-portapack/ext/fatfs/src/ff.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/baseband/dsp_goertzel.hpp b/firmware/baseband/dsp_goertzel.hpp index 65cf5b1d1..a0f620cde 100644 --- a/firmware/baseband/dsp_goertzel.hpp +++ b/firmware/baseband/dsp_goertzel.hpp @@ -35,7 +35,7 @@ class GoertzelDetector { private: float coefficient{}; - int16_t s[2]{0}; + int16_t s[3]{0}; }; } /* namespace dsp */ diff --git a/firmware/chibios-portapack/ext/fatfs/src/ff.c b/firmware/chibios-portapack/ext/fatfs/src/ff.c index fa9c50f32..862f0a56f 100644 --- a/firmware/chibios-portapack/ext/fatfs/src/ff.c +++ b/firmware/chibios-portapack/ext/fatfs/src/ff.c @@ -1835,7 +1835,7 @@ void gen_numname ( if (c > '9') c += 7; ns[i--] = c; seq /= 16; - } while (seq); + } while (seq && i != 0); ns[i] = '~'; /* Append the number */