diff --git a/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp b/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp index d800addab97..3cdc6ac8eeb 100644 --- a/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp +++ b/generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp @@ -593,6 +593,11 @@ int S3CrtClient::S3CrtRequestGetBodyCallback(struct aws_s3_meta_request* meta_re if (userData->request->IsEventStreamRequest()) { bodyStream.flush(); } + if (bodyStream.fail()) { + AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Failed to write download data"); + aws_raise_error(AWS_ERROR_FILE_WRITE_FAILURE); + return AWS_OP_ERR; + } // Replenish flow-control window (no-op if enable_read_backpressure is not set): aws_s3_meta_request_increment_read_window(meta_request, body->len); diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtSpecificOperations.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtSpecificOperations.vm index 98e0931ee10..92b0487d052 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtSpecificOperations.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtSpecificOperations.vm @@ -57,6 +57,11 @@ int S3CrtClient::S3CrtRequestGetBodyCallback(struct aws_s3_meta_request *meta_re { bodyStream.flush(); } + if (bodyStream.fail()) { + AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Failed to write download data"); + aws_raise_error(AWS_ERROR_FILE_WRITE_FAILURE); + return AWS_OP_ERR; + } // Replenish flow-control window (no-op if enable_read_backpressure is not set): aws_s3_meta_request_increment_read_window(meta_request, body->len); diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/SmithyS3CrtSpecificOperations.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/SmithyS3CrtSpecificOperations.vm index c0cfbcd2cac..009a2c5f8b2 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/SmithyS3CrtSpecificOperations.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/SmithyS3CrtSpecificOperations.vm @@ -57,6 +57,11 @@ int S3CrtClient::S3CrtRequestGetBodyCallback(struct aws_s3_meta_request *meta_re { bodyStream.flush(); } + if (bodyStream.fail()) { + AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Failed to write download data"); + aws_raise_error(AWS_ERROR_FILE_WRITE_FAILURE); + return AWS_OP_ERR; + } // Replenish flow-control window (no-op if enable_read_backpressure is not set): aws_s3_meta_request_increment_read_window(meta_request, body->len);