aws-sdk-cpp icon indicating copy to clipboard operation
aws-sdk-cpp copied to clipboard

[aws-cpp-sdk-s3-crt]: handle bad input stream passed to PutObjectAsync

Open grrtrr opened this issue 3 years ago • 0 comments

If PutObjectAsync is passed an input stream which is in a bad state (failbit or badbit set), the aws-c-s3 meta request fails with arcane errors, since the Content-Length is computed as the string "-1" (see #2093).

Avoid the late failure (with confusing error) by returning early with error if the user supplied an unusable input stream.

Resolves #2093.

Check all that applies:

  • [X] Did a review by yourself.
  • [X] Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • [X] Checked if this PR is a breaking (APIs have been changed) change.
  • [X] Checked if this PR will not introduce cross-platform inconsistent behavior.
  • [X] Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • [X] Linux
  • [ ] Windows
  • [ ] Android
  • [ ] MacOS
  • [ ] IOS
  • [ ] Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

grrtrr avatar Sep 13 '22 14:09 grrtrr