diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2022-07-21 10:02:49 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2022-07-21 10:02:49 +0300 |
commit | 7c3c2d7fb03a1591e94b4c02416793e6d7576a88 (patch) | |
tree | c91d3207bd454d95060b3472091c5db59c1db4b5 /contrib | |
parent | 2b837432409524fbb011dee286eac2cc16977240 (diff) | |
download | ydb-7c3c2d7fb03a1591e94b4c02416793e6d7576a88.tar.gz |
Update contrib/restricted/aws/aws-c-common to 0.7.5
Diffstat (limited to 'contrib')
8 files changed, 53 insertions, 17 deletions
diff --git a/contrib/restricted/aws/aws-c-common/README.md b/contrib/restricted/aws/aws-c-common/README.md index 95f4191c6d3..be3db7e6207 100644 --- a/contrib/restricted/aws/aws-c-common/README.md +++ b/contrib/restricted/aws/aws-c-common/README.md @@ -253,3 +253,11 @@ Not: AWS_LOGF_ERROR(AWS_LS_SOME_SUBJECT, "Invalid options - something is null"); return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } + +## CBMC + +To learn more about CBMC and proofs specifically, review the training material [here](https://model-checking.github.io/cbmc-training). + +The `verification/cbmc/proofs` directory contains CBMC proofs. + +In order to run these proofs you will need to install CBMC and other tools by following the instructions [here](https://model-checking.github.io/cbmc-training/installation.html). diff --git a/contrib/restricted/aws/aws-c-common/include/aws/common/json.h b/contrib/restricted/aws/aws-c-common/include/aws/common/json.h index 5182bbf1320..c8ee952f13c 100644 --- a/contrib/restricted/aws/aws-c-common/include/aws/common/json.h +++ b/contrib/restricted/aws/aws-c-common/include/aws/common/json.h @@ -269,19 +269,6 @@ bool aws_json_value_is_object(const struct aws_json_value *value); // Memory Management /** - * Initializes the JSON module for use. - * @param allocator The allocator to use for creating aws_json_value structs. - */ -AWS_COMMON_API -void aws_json_module_init(struct aws_allocator *allocator); - -/** - * Cleans up the JSON module. Should be called when finished using the module. - */ -AWS_COMMON_API -void aws_json_module_cleanup(void); - -/** * Removes the aws_json_value from memory. If the aws_json_value is a object or array, it will also destroy * attached aws_json_values as well. * diff --git a/contrib/restricted/aws/aws-c-common/include/aws/common/logging.h b/contrib/restricted/aws/aws-c-common/include/aws/common/logging.h index 1b34e3bae3e..d80ffba4101 100644 --- a/contrib/restricted/aws/aws-c-common/include/aws/common/logging.h +++ b/contrib/restricted/aws/aws-c-common/include/aws/common/logging.h @@ -314,6 +314,7 @@ extern struct aws_logger_vtable g_pipeline_logger_owned_vtable; /* * Initializes a logger that does not perform any allocation during logging. Log lines larger than the internal * constant are truncated. Formatting matches the standard logger. Used for memory tracing logging. + * If no file or filename is set in the aws_logger_standard_options, then it will use stderr. */ AWS_COMMON_API int aws_logger_init_noalloc( diff --git a/contrib/restricted/aws/aws-c-common/include/aws/common/private/json_impl.h b/contrib/restricted/aws/aws-c-common/include/aws/common/private/json_impl.h new file mode 100644 index 00000000000..df9d81a5cb0 --- /dev/null +++ b/contrib/restricted/aws/aws-c-common/include/aws/common/private/json_impl.h @@ -0,0 +1,22 @@ +#ifndef AWS_COMMON_PRIVATE_JSON_IMPL_H +#define AWS_COMMON_PRIVATE_JSON_IMPL_H + +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include <aws/common/common.h> + +/** + * Initializes the JSON module for use. + * @param allocator The allocator to use for creating aws_json_value structs. + */ +void aws_json_module_init(struct aws_allocator *allocator); + +/** + * Cleans up the JSON module. Should be called when finished using the module. + */ +void aws_json_module_cleanup(void); + +#endif // AWS_COMMON_PRIVATE_JSON_IMPL_H diff --git a/contrib/restricted/aws/aws-c-common/source/common.c b/contrib/restricted/aws/aws-c-common/source/common.c index 83a91b768fe..39e0faf3a25 100644 --- a/contrib/restricted/aws/aws-c-common/source/common.c +++ b/contrib/restricted/aws/aws-c-common/source/common.c @@ -4,10 +4,10 @@ */ #include <aws/common/common.h> -#include <aws/common/json.h> #include <aws/common/logging.h> #include <aws/common/math.h> #include <aws/common/private/dlloads.h> +#include <aws/common/private/json_impl.h> #include <aws/common/private/thread_shared.h> #include <stdarg.h> diff --git a/contrib/restricted/aws/aws-c-common/source/file.c b/contrib/restricted/aws/aws-c-common/source/file.c index a64453fd235..95a80b2ca53 100644 --- a/contrib/restricted/aws/aws-c-common/source/file.c +++ b/contrib/restricted/aws/aws-c-common/source/file.c @@ -12,6 +12,11 @@ #include <errno.h> FILE *aws_fopen(const char *file_path, const char *mode) { + if (!file_path || strlen(file_path) == 0) { + AWS_LOGF_ERROR(AWS_LS_COMMON_IO, "static: Failed to open file %s", file_path); + return NULL; + } + struct aws_string *file_path_str = aws_string_new_from_c_str(aws_default_allocator(), file_path); struct aws_string *mode_str = aws_string_new_from_c_str(aws_default_allocator(), mode); @@ -23,6 +28,7 @@ FILE *aws_fopen(const char *file_path, const char *mode) { } int aws_byte_buf_init_from_file(struct aws_byte_buf *out_buf, struct aws_allocator *alloc, const char *filename) { + AWS_ZERO_STRUCT(*out_buf); FILE *fp = aws_fopen(filename, "rb"); @@ -66,6 +72,9 @@ int aws_byte_buf_init_from_file(struct aws_byte_buf *out_buf, struct aws_allocat AWS_LOGF_ERROR(AWS_LS_COMMON_IO, "static: Failed to open file %s with errno %d", filename, errno); + if (errno == 0) { + return aws_raise_error(AWS_ERROR_FILE_INVALID_PATH); + } return aws_translate_and_raise_io_error(errno); } diff --git a/contrib/restricted/aws/aws-c-common/source/json.c b/contrib/restricted/aws/aws-c-common/source/json.c index 0f1b810be56..7f700af1fb3 100644 --- a/contrib/restricted/aws/aws-c-common/source/json.c +++ b/contrib/restricted/aws/aws-c-common/source/json.c @@ -7,6 +7,7 @@ #include <aws/common/string.h> #include <aws/common/json.h> +#include <aws/common/private/json_impl.h> #include <aws/common/external/cJSON.h> @@ -280,7 +281,10 @@ static void s_aws_cJSON_free(void *ptr) { void aws_json_module_init(struct aws_allocator *allocator) { if (!s_aws_json_module_initialized) { s_aws_json_module_allocator = allocator; - struct cJSON_Hooks allocation_hooks = {.malloc_fn = s_aws_cJSON_alloc, .free_fn = s_aws_cJSON_free}; + struct cJSON_Hooks allocation_hooks = { + .malloc_fn = s_aws_cJSON_alloc, + .free_fn = s_aws_cJSON_free, + }; cJSON_InitHooks(&allocation_hooks); s_aws_json_module_initialized = true; } diff --git a/contrib/restricted/aws/aws-c-common/source/logging.c b/contrib/restricted/aws/aws-c-common/source/logging.c index d7f0910da37..8df9078cd3c 100644 --- a/contrib/restricted/aws/aws-c-common/source/logging.c +++ b/contrib/restricted/aws/aws-c-common/source/logging.c @@ -547,8 +547,13 @@ int aws_logger_init_noalloc( impl->file = options->file; impl->should_close = false; } else { /* _MSC_VER */ - impl->file = aws_fopen(options->filename, "w"); - impl->should_close = true; + if (options->filename != NULL) { + impl->file = aws_fopen(options->filename, "w"); + impl->should_close = true; + } else { + impl->file = stderr; + impl->should_close = false; + } } aws_mutex_init(&impl->lock); |