From fc7710821efd02cc27a94f38fe6e70ffd7fc64b4 Mon Sep 17 00:00:00 2001 From: s0s Date: Tue, 24 Feb 2026 03:00:25 +0000 Subject: [PATCH] Common: fixes segmentation fault triggered by dereferencing value at negative index (#2198) --- src/common/impl/format.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/impl/format.c b/src/common/impl/format.c index 469aceed4..5bea2d0c8 100644 --- a/src/common/impl/format.c +++ b/src/common/impl/format.c @@ -204,7 +204,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n uint32_t index = getArgumentIndex(placeholderValue.chars, numArgs, arguments); // testing for an invalid index - if (index > numArgs) + if (index > numArgs || index < 1) { appendInvalidPlaceholder(buffer, "{?", &placeholderValue, i, formatstr->length); continue; @@ -230,7 +230,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n uint32_t index = getArgumentIndex(placeholderValue.chars, numArgs, arguments); // testing for an invalid index - if (index > numArgs) + if (index > numArgs || index < 1) { appendInvalidPlaceholder(buffer, "{/", &placeholderValue, i, formatstr->length); continue;