diff --git a/code/espurna/types.cpp b/code/espurna/types.cpp index b8dea724..3b559e93 100644 --- a/code/espurna/types.cpp +++ b/code/espurna/types.cpp @@ -383,6 +383,10 @@ update_floating: update_decimal: { + if ((last != Type::Unknown) && (type == Type::Unknown)) { + goto reset; + } + const auto result = parseUnsigned(token, 10); if (result.ok) { // num and den are constexpr and bound to ratio types, so duration cast has to happen manually diff --git a/code/test/unit/src/settings/settings.cpp b/code/test/unit/src/settings/settings.cpp index 95b00910..eb94b837 100644 --- a/code/test/unit/src/settings/settings.cpp +++ b/code/test/unit/src/settings/settings.cpp @@ -221,6 +221,11 @@ void test_parse_duration_spec() { } void test_parse_fail_duration_spec() { + test_parse_fail("1000us100"); + test_parse_fail("100s50"); + test_parse_fail("ms100"); + test_parse_fail("s200"); + test_parse_fail("u300"); test_parse_fail("123ui"); test_parse_fail("123s456sm"); test_parse_fail("456s\x01\\789uu");