Skip to content

Commit ebe3ed6

Browse files
committed
Add maximum length checks
1 parent 659858e commit ebe3ed6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

cuda_bindings/cuda/bindings/_nvml.pyx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10833,6 +10833,8 @@ cdef class ConfComputeGpuCertificate:
1083310833
def cert_chain(self, val):
1083410834
if self._readonly:
1083510835
raise ValueError("This ConfComputeGpuCertificate instance is read-only")
10836+
if len(val) > 4096:
10837+
raise ValueError(f"Too many elements for field cert_chain, max is 4096, got {len(val)}")
1083610838
self._ptr[0].certChainSize = len(val)
1083710839
if len(val) == 0:
1083810840
return
@@ -10853,6 +10855,8 @@ cdef class ConfComputeGpuCertificate:
1085310855
def attestation_cert_chain(self, val):
1085410856
if self._readonly:
1085510857
raise ValueError("This ConfComputeGpuCertificate instance is read-only")
10858+
if len(val) > 5120:
10859+
raise ValueError(f"Too many elements for field attestation_cert_chain, max is 5120, got {len(val)}")
1085610860
self._ptr[0].attestationCertChainSize = len(val)
1085710861
if len(val) == 0:
1085810862
return
@@ -11015,6 +11019,8 @@ cdef class ConfComputeGpuAttestationReport:
1101511019
def attestation_report(self, val):
1101611020
if self._readonly:
1101711021
raise ValueError("This ConfComputeGpuAttestationReport instance is read-only")
11022+
if len(val) > 8192:
11023+
raise ValueError(f"Too many elements for field attestation_report, max is 8192, got {len(val)}")
1101811024
self._ptr[0].attestationReportSize = len(val)
1101911025
if len(val) == 0:
1102011026
return
@@ -11035,6 +11041,8 @@ cdef class ConfComputeGpuAttestationReport:
1103511041
def cec_attestation_report(self, val):
1103611042
if self._readonly:
1103711043
raise ValueError("This ConfComputeGpuAttestationReport instance is read-only")
11044+
if len(val) > 4096:
11045+
raise ValueError(f"Too many elements for field cec_attestation_report, max is 4096, got {len(val)}")
1103811046
self._ptr[0].cecAttestationReportSize = len(val)
1103911047
if len(val) == 0:
1104011048
return
@@ -11363,6 +11371,8 @@ cdef class NvlinkSupportedBwModes_v1:
1136311371
def bw_modes(self, val):
1136411372
if self._readonly:
1136511373
raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only")
11374+
if len(val) > 23:
11375+
raise ValueError(f"Too many elements for field bw_modes, max is 23, got {len(val)}")
1136611376
self._ptr[0].totalBwModes = len(val)
1136711377
if len(val) == 0:
1136811378
return

0 commit comments

Comments
 (0)