[https://nvbugs/5825514][fix] Add null pointer check to parseNpyHeader (#10944)

Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
This PR addresses known security issues. For the latest NVIDIA Vulnerability Disclosure Information visit https://www.nvidia.com/en-us/security/, for acknowledgement please reach out to the NVIDIA PSIRT team at PSIRT@nvidia.com
This commit is contained in:
Yibin Li 2026-01-30 00:01:33 -08:00 committed by GitHub
parent 4f0c1b2489
commit 322471cdd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,6 +105,7 @@ void parseNpyIntro(FILE*& f_ptr, uint32_t& header_len, uint32_t& start_data)
int parseNpyHeader(FILE*& f_ptr, uint32_t header_len, nvinfer1::DataType& type, std::vector<size_t>& shapeVec)
{
char* header_c = (char*) malloc(header_len * sizeof(char));
TLLM_CHECK_WITH_INFO(header_c != nullptr, "Failed to allocate memory for npy header");
size_t n_elems = fread((void*) header_c, sizeof(char), header_len, f_ptr);
if (n_elems != header_len)
{