-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
What platform/OS are you using?
Windows 10 64bit Professional
What compiler are you using? what version?
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27045 for x64
What's your CMake arguments?
cmake ../${AWS_SDK_BASENAME} -G "Visual Studio 15 2017 Win64"
-DENABLE_TESTING=OFF
-DENABLE_UNITY_BUILD=ON
-DSIMPLE_INSTALL=OFF
-DAUTORUN_UNIT_TESTS=OFF
-DCMAKE_INSTALL_PREFIX="${TOOLS_X64}/${AWS_SDK_BASENAME}"
-DCMAKE_PDB_OUTPUT_DIRECTORY="${TOOLS_X64}/${AWS_SDK_BASENAME}/bin/windows/intel64"
-DCPP_STANDARD=17
-DBUILD_ONLY="s3;dynamodb;lambda;iam;autoscaling;application-autoscaling;sts;monitoring"
Where ${AWS_SDK_BASENAME} = 1.9.280
Can you provide a TRACE level log? (sanitize any sensitive information)
Later if required.
I have recently upgraded our product from 1.6.25 to 1.9.280 (1.6.25 has been in production for over a year).
PutObjectRequest oRequest;
oRequest.SetBucket(toUTF8(sBucket));
oRequest.SetKey(toUTF8(oKey.value()));
auto oOutcome = mpClient->PutObject(oRequest);
if (oOutcome.IsSuccess())
{
....
}
The code above now crashes in the SDK in aws-sdk-cpp-1.9.280-build\aws-sdk-cpp-1.9.280\aws-cpp-sdk-core\source\utils\crypto\bcrypt\CryptoImpl.cpp, line 351 because the struct 'stream' is NULL. It's NULL I think because I haven't set a body on the request as I want to create a 0 byte object in S3. This means that in aws-sdk-cpp-1.9.280\aws-cpp-sdk-core\source\client\AWSClient.cpp line 710 the stream value being passed into this code is NULL:
httpRequest->SetHeaderValue(Http::CONTENT_MD5_HEADER, HashingUtils::Base64Encode(HashingUtils::CalculateMD5(*(request.GetBody()))));
Now it may be that I've missed something with the new SDK version. If so I'd appreciate a steer in the right direction.
Thanks in advance for the help.
Expected Behavior
This call should work if the input request has no body.
auto oOutcome = mpClient->PutObject(oRequest);
Current Behavior
Reproduction Steps
This code crashes (for me):
PutObjectRequest oRequest;
oRequest.SetBucket(toUTF8(sBucket));
oRequest.SetKey(toUTF8(oKey.value()));
auto oOutcome = mpClient->PutObject(oRequest);
Possible Solution
Handle the case where an MD5 checksum is trying to be computed for a 0 byte request body.
Additional Information/Context
No response
AWS CPP SDK version used
1.9.280
Compiler and Version used
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27045 for x64
Operating System and version
Windows 10 64bit Professional
