From 7bf58945134f83a1b8433f53b345d1d7634fe733 Mon Sep 17 00:00:00 2001 From: srikappa-amzn Date: Wed, 8 Sep 2021 14:29:08 -0700 Subject: [PATCH] Set max file size limit as default parameter for ReadFile Signed-off-by: srikappa-amzn --- Code/Framework/AzCore/AzCore/Serialization/Json/JsonUtils.h | 3 ++- Code/Framework/AzCore/AzCore/Utils/Utils.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonUtils.h b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonUtils.h index c81497aa95..c684d0397a 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonUtils.h +++ b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonUtils.h @@ -70,7 +70,8 @@ namespace AZ //! Parse json text. Returns a failure with error message if the content is not valid JSON. AZ::Outcome ReadJsonString(AZStd::string_view jsonText); - //! Parse a json file. Returns a failure with error message if the content is not valid JSON. + //! Parse a json file. Returns a failure with error message if the content is not valid JSON or if + //! the file size is larger than the max file size provided. AZ::Outcome ReadJsonFile( AZStd::string_view filePath, size_t maxFileSize = AZStd::numeric_limits::max()); diff --git a/Code/Framework/AzCore/AzCore/Utils/Utils.h b/Code/Framework/AzCore/AzCore/Utils/Utils.h index 1d3cbd777b..d8d4290f7f 100644 --- a/Code/Framework/AzCore/AzCore/Utils/Utils.h +++ b/Code/Framework/AzCore/AzCore/Utils/Utils.h @@ -112,6 +112,6 @@ namespace AZ //! the file size is larger than the max file size provided. template AZ::Outcome ReadFile( - AZStd::string_view filePath, size_t maxFileSize); + AZStd::string_view filePath, size_t maxFileSize = AZStd::numeric_limits::max()); } }