mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-07-01 19:57:41 +00:00
Validate bulk binary sizes as integral metadata
Reject boolean and floating-point values for int64 bulk binary sizes instead of silently converting them with int(). Keep integer strings accepted for existing NVBench JSON compatibility, and add regression coverage for valid and malformed size payloads.
This commit is contained in:
@@ -845,6 +845,16 @@ def extract_binary_filename(summary):
|
||||
|
||||
def extract_binary_size(summary):
|
||||
value = extract_summary_data_value(summary, "size", "int64")
|
||||
if isinstance(value, bool):
|
||||
raise ValueError(
|
||||
f"summary {summary.get('tag', '<unknown>')!r} field 'size' "
|
||||
f"value {value!r} is not an int64"
|
||||
)
|
||||
if isinstance(value, float):
|
||||
raise ValueError(
|
||||
f"summary {summary.get('tag', '<unknown>')!r} field 'size' "
|
||||
f"value {value!r} is not an int64"
|
||||
)
|
||||
try:
|
||||
return int(value)
|
||||
except (TypeError, ValueError) as exc:
|
||||
|
||||
Reference in New Issue
Block a user