fix: infinite loop in proto reserved range parser (CWE-835) (#8966)

This commit is contained in:
dataCenter430
2026-03-11 22:23:32 -04:00
committed by GitHub
parent e35817577c
commit fc9909c30a

View File

@@ -3172,8 +3172,10 @@ CheckedError Parser::ParseProtoFields(StructDef* struct_def, bool isextend,
return Error("Protobuf has non positive number in reserved ids");
if (range) {
for (voffset_t id = from + 1; id <= attribute; id++)
struct_def->reserved_ids.push_back(id);
for (uint32_t id = static_cast<uint32_t>(from) + 1;
id <= static_cast<uint32_t>(attribute); id++) {
struct_def->reserved_ids.push_back(static_cast<voffset_t>(id));
}
range = false;
} else {