aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2025-06-11 17:59:02 -0400
committerKevin O'Connor <kevin@koconnor.net>2025-06-11 17:59:02 -0400
commitf54b7b9376ac86d5073e1df875c199184dfafb23 (patch)
treece7e99bb1012f4548a7e8c89ee4f735fb5ca042e /src
parent5666b88c698fe0ad85bf2e7646f0e9c837e2a08b (diff)
downloadkutter-f54b7b9376ac86d5073e1df875c199184dfafb23.tar.gz
kutter-f54b7b9376ac86d5073e1df875c199184dfafb23.tar.xz
kutter-f54b7b9376ac86d5073e1df875c199184dfafb23.zip
sos_filter: Fix validate_section_index() check
A section_idx equal to max_sections is also invalid. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/sos_filter.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sos_filter.c b/src/sos_filter.c
index 3ec5d617..04eb366e 100644
--- a/src/sos_filter.c
+++ b/src/sos_filter.c
@@ -108,7 +108,7 @@ sos_filter_oid_lookup(uint8_t oid)
static void
validate_section_index(struct sos_filter *sf, uint8_t section_idx)
{
- if (section_idx > sf->max_sections)
+ if (section_idx >= sf->max_sections)
shutdown("Filter section index larger than max_sections");
}
@@ -154,7 +154,8 @@ command_sos_filter_activate(uint32_t *args)
{
struct sos_filter *sf = sos_filter_oid_lookup(args[0]);
uint8_t n_sections = args[1];
- validate_section_index(sf, n_sections);
+ if (n_sections > sf->max_sections)
+ shutdown("Filter section index larger than max_sections");
sf->n_sections = n_sections;
const uint8_t coeff_int_bits = args[2];
sf->coeff_frac_bits = (31 - coeff_int_bits);