File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1691,8 +1691,15 @@ service::AwaitableResolver Result<)cpp"
1691
1691
[]()cpp" << _loader.getSchemaNamespace ()
1692
1692
<< R"cpp( ::)cpp" << enumType.cppType << R"cpp( value, const ResolverParams&)
1693
1693
{
1694
+ const size_t idx = static_cast<size_t>(value);
1695
+ if (idx >= s_names)cpp"
1696
+ << enumType.cppType << R"cpp( .size())
1697
+ {
1698
+ throw service::schema_exception { { R"ex(Enum value out of range for )cpp"
1699
+ << enumType.type << R"cpp( )ex" } };
1700
+ }
1694
1701
return ResolverResult { { response::ValueToken::EnumValue { std::string { s_names)cpp"
1695
- << enumType.cppType << R"cpp( [static_cast<std::size_t>(value) ] } } } };
1702
+ << enumType.cppType << R"cpp( [idx ] } } } };
1696
1703
});
1697
1704
}
1698
1705
You can’t perform that action at this time.
0 commit comments