diff --git a/src/base64.cpp b/src/base64.cpp index 470c1b8f2651731166a373fdf6ae509811a9389f..071b949cf000c287ed2266c805bfed57f1031b2c 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -28,10 +28,10 @@ namespace base64 { std::string encode(std::string_view dat) { - if (dat.empty()) + if (dat.empty() || dat.size() > INT_MAX) return {}; - int input_length = dat.size(); + int input_length = (int)dat.size(); int output_length = PJ_BASE256_TO_BASE64_LEN(input_length); std::string out; out.resize(output_length);