onnxruntime/include/onnxruntime/core/framework
Scott McKay df740d7d15
Throw if unique_ptr or array allocation fails due to SafeInt overflow (#18941)
### Description
<!-- Describe your changes. -->
If we fail to calculate the buffer size (due to overflow) we currently
return a nullptr. This is inconsistent as an actual memory allocation
failure throws. An overflow would typically be due to bad input so an
exception makes more sense given that.

Change to throw so code using MakeUniquePtr* and AllocArray* doesn't
need to check for nullptr.

Add some extra info to the log message to help debugging.

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Should help with #18905 by avoiding the invalid attempted usage of a
nullptr from the allocation. Extra info _might_ help with figuring out
where the overflow is coming from which is the real issue.
2024-01-03 07:57:51 +10:00
..
alloc_kind.h
allocator.h Throw if unique_ptr or array allocation fails due to SafeInt overflow (#18941) 2024-01-03 07:57:51 +10:00
buffer_deleter.h Multi-stream execution support (#13495) 2022-12-15 07:39:29 -08:00
customregistry.h
data_types.h [wasm] upgrade emsdk to 3.1.44 (#17069) 2023-08-10 16:08:36 -07:00
data_types_internal.h [wasm] upgrade emsdk to 3.1.44 (#17069) 2023-08-10 16:08:36 -07:00
endian.h
execution_provider.h remove AllocatorMgr class (#16509) 2023-06-28 15:43:19 -07:00
float8.h implement isinf20 and isnan20 (#17874) 2023-10-24 10:58:54 -07:00
float16.h [C#, CPP] Introduce Float16/BFloat16 support and tests for C#, C++ (#16506) 2023-07-14 10:46:52 -07:00
framework_common.h
framework_provider_common.h Add TRT plugins support using custom ops (#13847) 2023-04-18 20:24:32 -07:00
func_api.h Run clang-format in CI (#15524) 2023-04-18 09:26:58 -07:00
kernel_def_builder.h Remove onnxruntime_PYBIND_EXPORT_OPSCHEMA definition from onnxruntime (#15776) 2023-05-03 13:08:35 -07:00
kernel_registry.h Remove onnxruntime_PYBIND_EXPORT_OPSCHEMA definition from onnxruntime (#15776) 2023-05-03 13:08:35 -07:00
op_kernel.h [wasm] upgrade emsdk to 3.1.44 (#17069) 2023-08-10 16:08:36 -07:00
op_kernel_context.h ExecutionProvider API refactor - replace OrtMemoryInfo with OrtDevice (#15618) 2023-05-01 10:06:00 -07:00
op_kernel_info.h ExecutionProvider API refactor - move allocator from EP level to SessionState level and indexed by OrtDevice (#15833) 2023-06-19 17:44:45 -07:00
op_node_proto_helper.h MLAS AArch64 quantized int4 Gemm kernel (#18031) 2023-11-15 09:31:54 -08:00
ort_value.h Two fixes involving minimal builds (#17000) 2023-08-23 16:01:22 +10:00
ortdevice.h ExecutionProvider API refactor - replace OrtMemoryInfo with OrtDevice (#15618) 2023-05-01 10:06:00 -07:00
ortmemoryinfo.h Run clang-format in CI (#15524) 2023-04-18 09:26:58 -07:00
provider_options.h
provider_options_utils.h
provider_shutdown.h
run_options.h Adding RunOptions synchronization behaviour to C/C++ API (#14088) 2023-02-07 19:59:28 -08:00
sparse_tensor.h Run clang-format in CI (#15524) 2023-04-18 09:26:58 -07:00
stream_handles.h EP context for custom op (#16454) 2023-08-16 13:03:40 -07:00
tensor.h Handle string initializers in constant folding (#17422) 2023-09-27 21:15:58 +10:00
tensor_shape.h Make TensorShapeVector to use InlinedVector<Int64_t> to reduce on template instantiations (#18519) 2023-11-21 14:13:50 -08:00
to_tensor_proto_element_type.h [wasm] upgrade emsdk to 3.1.44 (#17069) 2023-08-10 16:08:36 -07:00