aboutsummaryrefslogtreecommitdiff
path: root/libbbot/manifest.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-03-19 08:11:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-03-19 08:11:38 +0200
commite0812957d606ddbde9db9df6cb468eb4ad689320 (patch)
tree7586beae6873603ae87efcc374a1cb95767e7bde /libbbot/manifest.cxx
parented8e64ca8525872c97f9331cb5c882b40864b84e (diff)
Validate ram-{minimum,maximum} in machine header manifest are not zeroHEADmaster
Diffstat (limited to 'libbbot/manifest.cxx')
-rw-r--r--libbbot/manifest.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx
index ab392e4..45a4668 100644
--- a/libbbot/manifest.cxx
+++ b/libbbot/manifest.cxx
@@ -276,8 +276,9 @@ namespace bbot
ram_minimum = parse_uint64 (v);
- if (!ram_minimum)
- bad_value ("machine minimum RAM should be 64-bit unsigned integer");
+ if (!ram_minimum || *ram_minimum == 0)
+ bad_value (
+ "machine minimum RAM should be non-zero 64-bit unsigned integer");
}
else if (n == "ram-maximum")
{
@@ -286,8 +287,9 @@ namespace bbot
ram_maximum = parse_uint64 (v);
- if (!ram_maximum)
- bad_value ("machine maximum RAM should be 64-bit unsigned integer");
+ if (!ram_maximum || *ram_maximum == 0)
+ bad_value (
+ "machine maximum RAM should be non-zero 64-bit unsigned integer");
}
else
{
@@ -333,10 +335,16 @@ namespace bbot
s.next ("role", to_string (*role));
if (ram_minimum)
+ {
+ assert (*ram_minimum != 0);
s.next ("ram-minimum", std::to_string (*ram_minimum));
+ }
if (ram_maximum)
+ {
+ assert (*ram_maximum != 0);
s.next ("ram-maximum", std::to_string (*ram_maximum));
+ }
if (end_of_manifest)
s.next ("", ""); // End of manifest.