From 6aedd25a2fe6bad3e98b67df1ba7da276f8f19ff Mon Sep 17 00:00:00 2001 From: Yingge He Date: Fri, 2 May 2025 18:47:49 -0700 Subject: [PATCH 1/2] Initial commit --- src/shape_tensor.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shape_tensor.cc b/src/shape_tensor.cc index 49930eb..df142d4 100644 --- a/src/shape_tensor.cc +++ b/src/shape_tensor.cc @@ -72,6 +72,11 @@ ShapeTensor::SetDataFromBuffer( *reinterpret_cast(data_.get()) = static_cast(total_batch_size); } + if (size_ < datatype_size) { + return TRITONSERVER_ErrorNew( + TRITONSERVER_ERROR_INVALID_ARG, + "Unexpected integer underflow while calculating shape tensor size."); + } std::memcpy( data_.get() + datatype_size, data_buffer, size_ - datatype_size); } else { From 53793d3eeefe253393f3002797691e090057c53e Mon Sep 17 00:00:00 2001 From: Yingge He Date: Fri, 2 May 2025 18:57:39 -0700 Subject: [PATCH 2/2] Update copyright --- src/shape_tensor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shape_tensor.cc b/src/shape_tensor.cc index df142d4..8cca781 100644 --- a/src/shape_tensor.cc +++ b/src/shape_tensor.cc @@ -1,4 +1,4 @@ -// Copyright 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions