Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package aws-c-common for openSUSE:Factory checked in at 2024-05-16 17:13:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/aws-c-common (Old) and /work/SRC/openSUSE:Factory/.aws-c-common.new.1880 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "aws-c-common" Thu May 16 17:13:51 2024 rev:6 rq:1173651 version:0.9.19 Changes: -------- --- /work/SRC/openSUSE:Factory/aws-c-common/aws-c-common.changes 2024-05-09 13:13:16.181046945 +0200 +++ /work/SRC/openSUSE:Factory/.aws-c-common.new.1880/aws-c-common.changes 2024-05-16 17:15:44.289146206 +0200 @@ -1,0 +2,15 @@ +Mon May 13 08:31:15 UTC 2024 - John Paul Adrian Glaubitz <[email protected]> + +- Update to version 0.9.19 + * Fix aws_host_utils_is_ipv6 function by @waahm7 in (#1114) +- from version 0.9.18 + * memtrace: Fix underflow when stack_depth < FRAMES_TO_SKIP + by @zhaofengli in (#873) + * chore: Make CBMC stubs with zero parameters proper + declarations by @tautschnig in (#1107) + * Satisfy some signed vs unsigned comparison + warnings by @KaibaLopez in (#809) + * Remove promise class by @waahm7 in (#1110) + * Fix host parsing for IPv6 URI by @waahm7 in (#1112) + +------------------------------------------------------------------- Old: ---- v0.9.17.tar.gz New: ---- v0.9.19.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ aws-c-common.spec ++++++ --- /var/tmp/diff_new_pack.LC9tfz/_old 2024-05-16 17:15:45.609194049 +0200 +++ /var/tmp/diff_new_pack.LC9tfz/_new 2024-05-16 17:15:45.617194339 +0200 @@ -19,7 +19,7 @@ %define library_version 1.0.0 %define library_soversion 1 Name: aws-c-common -Version: 0.9.17 +Version: 0.9.19 Release: 0 Summary: Core C99 package for AWS SDK for C License: Apache-2.0 ++++++ v0.9.17.tar.gz -> v0.9.19.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/include/aws/common/promise.h new/aws-c-common-0.9.19/include/aws/common/promise.h --- old/aws-c-common-0.9.17/include/aws/common/promise.h 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/include/aws/common/promise.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,103 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#ifndef AWS_COMMON_PROMISE_H -#define AWS_COMMON_PROMISE_H - -#include <aws/common/common.h> - -AWS_PUSH_SANE_WARNING_LEVEL - -/* - * Standard promise interface. Promise can be waited on by multiple threads, and as long as it is - * ref-counted correctly, will provide the resultant value/error code to all waiters. - * All promise API calls are internally thread-safe. - */ -struct aws_promise; - -AWS_EXTERN_C_BEGIN - -/* - * Creates a new promise - */ -AWS_COMMON_API -struct aws_promise *aws_promise_new(struct aws_allocator *allocator); - -/* - * Indicate a new reference to a promise. At minimum, each new thread making use of the promise should - * acquire it. - */ -AWS_COMMON_API -struct aws_promise *aws_promise_acquire(struct aws_promise *promise); - -/* - * Releases a reference on the promise. When the refcount hits 0, the promise is cleaned up and freed. - */ -AWS_COMMON_API -void aws_promise_release(struct aws_promise *promise); - -/* - * Waits infinitely for the promise to be completed - */ -AWS_COMMON_API -void aws_promise_wait(struct aws_promise *promise); -/* - * Waits for the requested time in nanoseconds. Returns true if the promise was completed. - */ -AWS_COMMON_API -bool aws_promise_wait_for(struct aws_promise *promise, size_t nanoseconds); - -/* - * Completes the promise and stores the result along with an optional destructor. If the value - * is not taken via `aws_promise_take_value`, it will be destroyed when the promise's reference - * count reaches zero. - * NOTE: Promise cannot be completed twice - */ -AWS_COMMON_API -void aws_promise_complete(struct aws_promise *promise, void *value, void (*dtor)(void *)); - -/* - * Completes the promise and stores the error code - * NOTE: Promise cannot be completed twice - */ -AWS_COMMON_API -void aws_promise_fail(struct aws_promise *promise, int error_code); - -/* - * Returns whether or not the promise has completed (regardless of success or failure) - */ -AWS_COMMON_API -bool aws_promise_is_complete(struct aws_promise *promise); - -/* - * Returns the error code recorded if the promise failed, or 0 if it succeeded - * NOTE: It is fatal to attempt to retrieve the error code before the promise is completed - */ -AWS_COMMON_API -int aws_promise_error_code(struct aws_promise *promise); - -/* - * Returns the value provided to the promise if it succeeded, or NULL if none was provided - * or the promise failed. Check `aws_promise_error_code` to be sure. - * NOTE: The ownership of the value is retained by the promise. - * NOTE: It is fatal to attempt to retrieve the value before the promise is completed - */ -AWS_COMMON_API -void *aws_promise_value(struct aws_promise *promise); - -/* - * Returns the value provided to the promise if it succeeded, or NULL if none was provided - * or the promise failed. Check `aws_promise_error_code` to be sure. - * NOTE: The promise relinquishes ownership of the value, the caller is now responsible for - * freeing any resources associated with the value - * NOTE: It is fatal to attempt to take the value before the promise is completed - */ -AWS_COMMON_API -void *aws_promise_take_value(struct aws_promise *promise); - -AWS_EXTERN_C_END -AWS_POP_SANE_WARNING_LEVEL - -#endif // AWS_COMMON_PROMISE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/source/arch/intel/encoding_avx2.c new/aws-c-common-0.9.19/source/arch/intel/encoding_avx2.c --- old/aws-c-common-0.9.17/source/arch/intel/encoding_avx2.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/source/arch/intel/encoding_avx2.c 2024-05-11 01:22:14.000000000 +0200 @@ -194,13 +194,13 @@ size_t aws_common_private_base64_decode_sse41(const unsigned char *in, unsigned char *out, size_t len) { if (len % 4) { - return (size_t)-1; + return SIZE_MAX; } size_t outlen = 0; while (len > 32) { if (!decode(in, out)) { - return (size_t)-1; + return SIZE_MAX; } len -= 32; in += 32; @@ -230,13 +230,13 @@ } if (!decode(tmp_in, tmp_out)) { - return (size_t)-1; + return SIZE_MAX; } /* Check that there are no trailing ones bits */ for (size_t i = final_out; i < sizeof(tmp_out); i++) { if (tmp_out[i]) { - return (size_t)-1; + return SIZE_MAX; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/source/encoding.c new/aws-c-common-0.9.19/source/encoding.c --- old/aws-c-common-0.9.17/source/encoding.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/source/encoding.c 2024-05-11 01:22:14.000000000 +0200 @@ -23,7 +23,7 @@ (void)out; (void)len; AWS_ASSERT(false); - return (size_t)-1; /* unreachable */ + return SIZE_MAX; /* unreachable */ } static inline void aws_common_private_base64_encode_sse41(const unsigned char *in, unsigned char *out, size_t len) { (void)in; @@ -361,7 +361,7 @@ if (aws_common_private_has_avx2()) { size_t result = aws_common_private_base64_decode_sse41(to_decode->ptr, output->buffer, to_decode->len); - if (result == -1) { + if (result == SIZE_MAX) { return aws_raise_error(AWS_ERROR_INVALID_BASE64_STR); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/source/host_utils.c new/aws-c-common-0.9.19/source/host_utils.c --- old/aws-c-common-0.9.17/source/host_utils.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/source/host_utils.c 2024-05-11 01:22:14.000000000 +0200 @@ -20,10 +20,6 @@ return aws_isxdigit(value) || value == ':'; } -static bool s_starts_with(struct aws_byte_cursor cur, uint8_t ch) { - return cur.len > 0 && cur.ptr[0] == ch; -} - static bool s_ends_with(struct aws_byte_cursor cur, uint8_t ch) { return cur.len > 0 && cur.ptr[cur.len - 1] == ch; } @@ -69,8 +65,7 @@ * ipv6 literal can be scoped by to zone by appending % followed by zone name * ( does not look like there is length reqs on zone name length. this * implementation enforces that its > 1 ) - * ipv6 can be embedded in url, in which case it must be wrapped inside [] - * and % be uri encoded as %25. + * ipv6 can be embedded in url, in which case % must be uri encoded as %25. * Implementation is fairly trivial and just iterates through the string * keeping track of the spec above. */ @@ -79,14 +74,6 @@ return false; } - if (is_uri_encoded) { - if (!s_starts_with(host, '[') || !s_ends_with(host, ']')) { - return false; - } - aws_byte_cursor_advance(&host, 1); - --host.len; - } - struct aws_byte_cursor substr = {0}; /* first split is required ipv6 part */ bool is_split = aws_byte_cursor_next_split(&host, '%', &substr); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/source/memtrace.c new/aws-c-common-0.9.19/source/memtrace.c --- old/aws-c-common-0.9.17/source/memtrace.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/source/memtrace.c 2024-05-11 01:22:14.000000000 +0200 @@ -134,7 +134,7 @@ /* capture stack frames, skip 2 for this function and the allocation vtable function */ AWS_VARIABLE_LENGTH_ARRAY(void *, stack_frames, (FRAMES_TO_SKIP + tracer->frames_per_stack)); size_t stack_depth = aws_backtrace(stack_frames, FRAMES_TO_SKIP + tracer->frames_per_stack); - if (stack_depth) { + if (stack_depth >= FRAMES_TO_SKIP) { /* hash the stack pointers */ struct aws_byte_cursor stack_cursor = aws_byte_cursor_from_array(stack_frames, stack_depth * sizeof(void *)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/source/promise.c new/aws-c-common-0.9.19/source/promise.c --- old/aws-c-common-0.9.17/source/promise.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/source/promise.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,118 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include <aws/common/condition_variable.h> -#include <aws/common/mutex.h> -#include <aws/common/promise.h> -#include <aws/common/ref_count.h> - -struct aws_promise { - struct aws_allocator *allocator; - struct aws_mutex mutex; - struct aws_condition_variable cv; - struct aws_ref_count rc; - bool complete; - int error_code; - void *value; - - /* destructor for value, will be invoked if the value is not taken */ - void (*dtor)(void *); -}; - -static void s_aws_promise_dtor(void *ptr) { - struct aws_promise *promise = ptr; - aws_condition_variable_clean_up(&promise->cv); - aws_mutex_clean_up(&promise->mutex); - if (promise->value && promise->dtor) { - promise->dtor(promise->value); - } - aws_mem_release(promise->allocator, promise); -} - -struct aws_promise *aws_promise_new(struct aws_allocator *allocator) { - struct aws_promise *promise = aws_mem_calloc(allocator, 1, sizeof(struct aws_promise)); - promise->allocator = allocator; - aws_ref_count_init(&promise->rc, promise, s_aws_promise_dtor); - aws_mutex_init(&promise->mutex); - aws_condition_variable_init(&promise->cv); - return promise; -} - -struct aws_promise *aws_promise_acquire(struct aws_promise *promise) { - aws_ref_count_acquire(&promise->rc); - return promise; -} - -void aws_promise_release(struct aws_promise *promise) { - aws_ref_count_release(&promise->rc); -} - -static bool s_promise_completed(void *user_data) { - struct aws_promise *promise = user_data; - return promise->complete; -} - -void aws_promise_wait(struct aws_promise *promise) { - aws_mutex_lock(&promise->mutex); - aws_condition_variable_wait_pred(&promise->cv, &promise->mutex, s_promise_completed, promise); - aws_mutex_unlock(&promise->mutex); -} - -bool aws_promise_wait_for(struct aws_promise *promise, size_t nanoseconds) { - aws_mutex_lock(&promise->mutex); - aws_condition_variable_wait_for_pred( - &promise->cv, &promise->mutex, (int64_t)nanoseconds, s_promise_completed, promise); - const bool complete = promise->complete; - aws_mutex_unlock(&promise->mutex); - return complete; -} - -bool aws_promise_is_complete(struct aws_promise *promise) { - aws_mutex_lock(&promise->mutex); - const bool complete = promise->complete; - aws_mutex_unlock(&promise->mutex); - return complete; -} - -void aws_promise_complete(struct aws_promise *promise, void *value, void (*dtor)(void *)) { - aws_mutex_lock(&promise->mutex); - AWS_FATAL_ASSERT(!promise->complete && "aws_promise_complete: cannot complete a promise more than once"); - promise->value = value; - promise->dtor = dtor; - promise->complete = true; - /* Notify before unlocking to prevent a race condition where the recipient spuriously - * awakens after the unlock, sees a fulfilled promise, and attempts to free its resources - * before the notification has actually occured. */ - aws_condition_variable_notify_all(&promise->cv); - aws_mutex_unlock(&promise->mutex); -} - -void aws_promise_fail(struct aws_promise *promise, int error_code) { - AWS_FATAL_ASSERT(error_code != 0 && "aws_promise_fail: cannot fail a promise with a 0 error_code"); - aws_mutex_lock(&promise->mutex); - AWS_FATAL_ASSERT(!promise->complete && "aws_promise_fail: cannot complete a promise more than once"); - promise->error_code = error_code; - promise->complete = true; - aws_condition_variable_notify_all(&promise->cv); - aws_mutex_unlock(&promise->mutex); -} - -int aws_promise_error_code(struct aws_promise *promise) { - AWS_FATAL_ASSERT(aws_promise_is_complete(promise)); - return promise->error_code; -} - -void *aws_promise_value(struct aws_promise *promise) { - AWS_FATAL_ASSERT(aws_promise_is_complete(promise)); - return promise->value; -} - -void *aws_promise_take_value(struct aws_promise *promise) { - AWS_FATAL_ASSERT(aws_promise_is_complete(promise)); - void *value = promise->value; - promise->value = NULL; - promise->dtor = NULL; - return value; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/source/uri.c new/aws-c-common-0.9.19/source/uri.c --- old/aws-c-common-0.9.17/source/uri.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/source/uri.c 2024-05-11 01:22:14.000000000 +0200 @@ -364,7 +364,9 @@ * IPv6 literals and only search for port delimiter after closing bracket.*/ const uint8_t *port_search_start = authority_parse_csr.ptr; size_t port_search_len = authority_parse_csr.len; + bool is_IPv6_literal = false; if (authority_parse_csr.len > 0 && authority_parse_csr.ptr[0] == '[') { + is_IPv6_literal = true; port_search_start = memchr(authority_parse_csr.ptr, ']', authority_parse_csr.len); if (!port_search_start) { parser->state = ERROR; @@ -375,17 +377,24 @@ } const uint8_t *port_delim = memchr(port_search_start, ':', port_search_len); - + /* + * RFC-3986 section 3.2.2: A host identified by an IPv6 literal address is represented inside square + * brackets. + * Ignore the square brackets. + */ + parser->uri->host_name = authority_parse_csr; + if (is_IPv6_literal) { + aws_byte_cursor_advance(&parser->uri->host_name, 1); + parser->uri->host_name.len--; + } if (!port_delim) { parser->uri->port = 0; - parser->uri->host_name = authority_parse_csr; return; } - parser->uri->host_name.ptr = authority_parse_csr.ptr; - parser->uri->host_name.len = port_delim - authority_parse_csr.ptr; - - size_t port_len = authority_parse_csr.len - parser->uri->host_name.len - 1; + size_t host_name_length_correction = is_IPv6_literal ? 2 : 0; + parser->uri->host_name.len = port_delim - authority_parse_csr.ptr - host_name_length_correction; + size_t port_len = authority_parse_csr.len - parser->uri->host_name.len - 1 - host_name_length_correction; port_delim += 1; uint64_t port_u64 = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/tests/CMakeLists.txt new/aws-c-common-0.9.19/tests/CMakeLists.txt --- old/aws-c-common-0.9.17/tests/CMakeLists.txt 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/tests/CMakeLists.txt 2024-05-11 01:22:14.000000000 +0200 @@ -489,12 +489,6 @@ add_test_case(test_normalize_windows_directory_separator) add_test_case(test_byte_buf_init_from_file) -add_test_case(promise_test_wait_forever) -add_test_case(promise_test_wait_for_a_bit) -add_test_case(promise_test_finish_immediately) -add_test_case(promise_test_finish_before_wait) -add_test_case(promise_test_multiple_waiters) - add_test_case(test_json_parse_from_string) add_test_case(test_json_parse_to_string) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/tests/atomics_test.c new/aws-c-common-0.9.19/tests/atomics_test.c --- old/aws-c-common-0.9.17/tests/atomics_test.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/tests/atomics_test.c 2024-05-11 01:22:14.000000000 +0200 @@ -272,7 +272,7 @@ int *participant_indexes = alloca(n_participants_local * sizeof(*participant_indexes)); struct aws_thread *threads = alloca(n_participants_local * sizeof(struct aws_thread)); - *last_race = (size_t)-1; + *last_race = SIZE_MAX; n_participants = n_participants_local; done_racing = false; aws_atomic_init_int(&last_race_index, 0); @@ -293,7 +293,7 @@ *last_race = n_races; } else { *last_race = (size_t)aws_atomic_load_int_explicit(&last_race_index, aws_memory_order_relaxed); - if (*last_race == (size_t)-1) { + if (*last_race == SIZE_MAX) { /* We didn't even see the first race complete */ *last_race = 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/tests/host_util_test.c new/aws-c-common-0.9.19/tests/host_util_test.c --- old/aws-c-common-0.9.17/tests/host_util_test.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/tests/host_util_test.c 2024-05-11 01:22:14.000000000 +0200 @@ -46,10 +46,10 @@ ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("0:0:0:0:0:0:0:1"), false)); ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fd00:ec2::23"), false)); ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fd00:ec2:0:0:0:0:0:23"), false)); - ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("[2001:0db8:0000:0000:0000:8a2e:0370:7334]"), true)); - ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("[fe80::1]"), true)); - ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("[fe80::1%25en0]"), true)); - ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("[2001:db8:85a3:8d3:1319:8a2e:370:7348]"), true)); + ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("2001:0db8:0000:0000:0000:8a2e:0370:7334"), true)); + ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fe80::1"), true)); + ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fe80::1%25en0"), true)); + ASSERT_TRUE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("2001:db8:85a3:8d3:1319:8a2e:370:7348"), true)); ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("2001:0db8:0000:0000:0000:8a2e:0370"), false)); ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("2001:0db8:0000:0000:0000:8a2e:0370:"), false)); @@ -63,12 +63,11 @@ ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("z001::8a2e::8745"), false)); ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("::2001:0db8:0000:0000:8a2e:0370:7334"), false)); - ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fe80::1%25en0"), true)); - ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("[fe80::1%en0]"), true)); - ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("[fe80::1%24en0]"), true)); + ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fe80::1%en0"), true)); + ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fe80::1%24en0"), true)); ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("[fe80::1%25en0"), true)); ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fe80::1%25en0]"), true)); - ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("[fe80::1%25]"), true)); + ASSERT_FALSE(aws_host_utils_is_ipv6(aws_byte_cursor_from_c_str("fe80::1%25"), true)); return AWS_OP_SUCCESS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/tests/promise_test.c new/aws-c-common-0.9.19/tests/promise_test.c --- old/aws-c-common-0.9.17/tests/promise_test.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/tests/promise_test.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,181 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include <aws/common/clock.h> -#include <aws/common/promise.h> -#include <aws/common/thread.h> - -#include <aws/testing/aws_test_harness.h> - -struct promise_test_work { - struct aws_allocator *allocator; - struct aws_promise *promise; - uint64_t work_time; - int error_code; - void *value; - void (*dtor)(void *); -}; - -static void s_promise_test_worker(void *data) { - struct promise_test_work *work = data; - aws_promise_acquire(work->promise); - aws_thread_current_sleep(work->work_time); - if (work->error_code) { - aws_promise_fail(work->promise, work->error_code); - } else { - aws_promise_complete(work->promise, work->value, work->dtor); - } - aws_promise_release(work->promise); -} - -static struct aws_thread s_promise_test_launch_worker(struct promise_test_work *work) { - const struct aws_thread_options *thread_options = aws_default_thread_options(); - AWS_FATAL_ASSERT(thread_options); - struct aws_thread worker_thread; - AWS_FATAL_ASSERT(aws_thread_init(&worker_thread, work->allocator) == AWS_OP_SUCCESS); - AWS_FATAL_ASSERT(aws_thread_launch(&worker_thread, s_promise_test_worker, work, thread_options) == AWS_OP_SUCCESS); - return worker_thread; -} - -struct pmr_payload { - struct aws_allocator *allocator; -}; - -void s_promise_test_free(void *ptr) { - struct pmr_payload *payload = ptr; - aws_mem_release(payload->allocator, payload); -} - -static int s_promise_test_wait_forever(struct aws_allocator *allocator, void *ctx) { - (void)ctx; - struct aws_promise *promise = aws_promise_new(allocator); - ASSERT_NOT_NULL(promise); - - struct pmr_payload *payload = aws_mem_acquire(allocator, 42); - payload->allocator = allocator; - - struct promise_test_work work = { - .allocator = allocator, - .promise = promise, - .work_time = 2 * 1000 * 1000, - .value = payload, - .dtor = s_promise_test_free, - }; - struct aws_thread worker_thread = s_promise_test_launch_worker(&work); - - aws_promise_wait(promise); - ASSERT_SUCCESS(aws_thread_join(&worker_thread)); - aws_promise_release(promise); - - return 0; -} - -AWS_TEST_CASE(promise_test_wait_forever, s_promise_test_wait_forever) - -static int s_promise_test_wait_for_a_bit(struct aws_allocator *allocator, void *ctx) { - (void)ctx; - struct aws_promise *promise = aws_promise_new(allocator); - ASSERT_NOT_NULL(promise); - - struct promise_test_work work = { - .allocator = allocator, - .promise = promise, - .work_time = 3 * 1000 * 1000, - }; - struct aws_thread worker_thread = s_promise_test_launch_worker(&work); - /* wait until the worker finishes, in 500ms intervals */ - while (!aws_promise_wait_for(promise, 500)) - ; - - ASSERT_TRUE(aws_promise_error_code(promise) == 0); - ASSERT_NULL(aws_promise_value(promise)); - - ASSERT_SUCCESS(aws_thread_join(&worker_thread)); - aws_promise_release(promise); - - return 0; -} - -AWS_TEST_CASE(promise_test_wait_for_a_bit, s_promise_test_wait_for_a_bit) - -static int s_promise_test_finish_immediately(struct aws_allocator *allocator, void *ctx) { - (void)ctx; - struct aws_promise *promise = aws_promise_new(allocator); - ASSERT_NOT_NULL(promise); - - struct promise_test_work work = { - .allocator = allocator, - .promise = promise, - .work_time = 0, - }; - struct aws_thread worker_thread = s_promise_test_launch_worker(&work); - aws_promise_wait(promise); - ASSERT_TRUE(aws_promise_error_code(promise) == 0); - ASSERT_NULL(aws_promise_value(promise)); - aws_promise_release(promise); - ASSERT_SUCCESS(aws_thread_join(&worker_thread)); - - return 0; -} - -AWS_TEST_CASE(promise_test_finish_immediately, s_promise_test_finish_immediately) - -static int s_promise_test_finish_before_wait(struct aws_allocator *allocator, void *ctx) { - (void)ctx; - struct aws_promise *promise = aws_promise_new(allocator); - ASSERT_NOT_NULL(promise); - - aws_promise_fail(promise, 1024); - aws_promise_wait(promise); - - ASSERT_TRUE(aws_promise_error_code(promise) == 1024); - ASSERT_NULL(aws_promise_value(promise)); - aws_promise_release(promise); - - return 0; -} - -AWS_TEST_CASE(promise_test_finish_before_wait, s_promise_test_finish_before_wait) - -void s_promise_test_waiter(void *data) { - struct promise_test_work *work = data; - aws_promise_acquire(work->promise); - /* sleep 0.2 seconds */ - aws_thread_current_sleep(1000 * 1000 * 2); - aws_promise_wait(work->promise); - AWS_FATAL_ASSERT(aws_promise_error_code(work->promise) == 0); - aws_promise_release(work->promise); -} - -static int s_promise_test_multiple_waiters(struct aws_allocator *allocator, void *ctx) { - (void)ctx; - struct aws_promise *promise = aws_promise_new(allocator); - ASSERT_NOT_NULL(promise); - - struct promise_test_work work = { - .allocator = allocator, - .promise = promise, - .work_time = 2 * 1000 * 1000, - .value = promise, - }; - struct aws_thread threads[8]; - const struct aws_thread_options *worker_options = aws_default_thread_options(); - for (int idx = 0; idx < AWS_ARRAY_SIZE(threads); ++idx) { - aws_thread_init(&threads[idx], allocator); - aws_thread_launch(&threads[idx], s_promise_test_waiter, &work, worker_options); - } - - aws_thread_current_sleep(1000 * 1000 * 4); - aws_promise_complete(promise, promise, NULL); - aws_promise_release(promise); - - for (int idx = 0; idx < AWS_ARRAY_SIZE(threads); ++idx) { - ASSERT_SUCCESS(aws_thread_join(&threads[idx])); - } - - return 0; -} - -AWS_TEST_CASE(promise_test_multiple_waiters, s_promise_test_multiple_waiters) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/tests/uri_test.c new/aws-c-common-0.9.19/tests/uri_test.c --- old/aws-c-common-0.9.17/tests/uri_test.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/tests/uri_test.c 2024-05-11 01:22:14.000000000 +0200 @@ -509,7 +509,7 @@ aws_byte_cursor_from_c_str("[2001:db8:85a3:8d3:1319:8a2e:370:7348%25en0]:443"); ASSERT_BIN_ARRAYS_EQUALS(expected_authority.ptr, expected_authority.len, uri.authority.ptr, uri.authority.len); - struct aws_byte_cursor expected_host = aws_byte_cursor_from_c_str("[2001:db8:85a3:8d3:1319:8a2e:370:7348%25en0]"); + struct aws_byte_cursor expected_host = aws_byte_cursor_from_c_str("2001:db8:85a3:8d3:1319:8a2e:370:7348%25en0"); ASSERT_BIN_ARRAYS_EQUALS(expected_host.ptr, expected_host.len, uri.host_name.ptr, uri.host_name.len); ASSERT_UINT_EQUALS(443, uri.port); @@ -540,7 +540,7 @@ aws_byte_cursor_from_c_str("[2001:db8:85a3:8d3:1319:8a2e:370:7348%25en0]"); ASSERT_BIN_ARRAYS_EQUALS(expected_authority.ptr, expected_authority.len, uri.authority.ptr, uri.authority.len); - struct aws_byte_cursor expected_host = aws_byte_cursor_from_c_str("[2001:db8:85a3:8d3:1319:8a2e:370:7348%25en0]"); + struct aws_byte_cursor expected_host = aws_byte_cursor_from_c_str("2001:db8:85a3:8d3:1319:8a2e:370:7348%25en0"); ASSERT_BIN_ARRAYS_EQUALS(expected_host.ptr, expected_host.len, uri.host_name.ptr, uri.host_name.len); struct aws_byte_cursor expected_path = aws_byte_cursor_from_c_str(""); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/verification/cbmc/include/proof_helpers/aws_byte_cursor_read_common.h new/aws-c-common-0.9.19/verification/cbmc/include/proof_helpers/aws_byte_cursor_read_common.h --- old/aws-c-common-0.9.17/verification/cbmc/include/proof_helpers/aws_byte_cursor_read_common.h 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/verification/cbmc/include/proof_helpers/aws_byte_cursor_read_common.h 2024-05-11 01:22:14.000000000 +0200 @@ -6,7 +6,7 @@ #include <aws/common/byte_buf.h> #include <proof_helpers/make_common_data_structures.h> -void aws_byte_cursor_read_common_harness() { +void aws_byte_cursor_read_common_harness(void) { /* parameters */ struct aws_byte_cursor cur; DEST_TYPE *dest = malloc(sizeof(*dest)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/verification/cbmc/include/proof_helpers/make_common_data_structures.h new/aws-c-common-0.9.19/verification/cbmc/include/proof_helpers/make_common_data_structures.h --- old/aws-c-common-0.9.17/verification/cbmc/include/proof_helpers/make_common_data_structures.h 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/verification/cbmc/include/proof_helpers/make_common_data_structures.h 2024-05-11 01:22:14.000000000 +0200 @@ -127,7 +127,7 @@ /** * Ensures a valid string is allocated, with as much nondet as possible */ -struct aws_string *ensure_string_is_allocated_nondet_length(); +struct aws_string *ensure_string_is_allocated_nondet_length(void); /** * Ensures a valid string is allocated, with as much nondet as possible, but len < max diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/verification/cbmc/include/proof_helpers/nondet.h new/aws-c-common-0.9.19/verification/cbmc/include/proof_helpers/nondet.h --- old/aws-c-common-0.9.17/verification/cbmc/include/proof_helpers/nondet.h 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/verification/cbmc/include/proof_helpers/nondet.h 2024-05-11 01:22:14.000000000 +0200 @@ -12,11 +12,11 @@ /** * Non-determinstic functions used in CBMC proofs */ -bool nondet_bool(); -int nondet_int(); -size_t nondet_size_t(); -uint16_t nondet_uint16_t(); -uint32_t nondet_uint32_t(); -uint64_t nondet_uint64_t(); -uint8_t nondet_uint8_t(); -void *nondet_voidp(); +bool nondet_bool(void); +int nondet_int(void); +size_t nondet_size_t(void); +uint16_t nondet_uint16_t(void); +uint32_t nondet_uint32_t(void); +uint64_t nondet_uint64_t(void); +uint8_t nondet_uint8_t(void); +void *nondet_voidp(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/verification/cbmc/sources/make_common_data_structures.c new/aws-c-common-0.9.19/verification/cbmc/sources/make_common_data_structures.c --- old/aws-c-common-0.9.17/verification/cbmc/sources/make_common_data_structures.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/verification/cbmc/sources/make_common_data_structures.c 2024-05-11 01:22:14.000000000 +0200 @@ -189,7 +189,7 @@ */ void hash_proof_destroy_noop(void *p) {} -struct aws_string *ensure_string_is_allocated_nondet_length() { +struct aws_string *ensure_string_is_allocated_nondet_length(void) { /* Considers any size up to the maximum possible size for the array [bytes] in aws_string */ return nondet_allocate_string_bounded_length(SIZE_MAX - 1 - sizeof(struct aws_string)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.17/verification/cbmc/stubs/abort_override_assert_false.c new/aws-c-common-0.9.19/verification/cbmc/stubs/abort_override_assert_false.c --- old/aws-c-common-0.9.17/verification/cbmc/stubs/abort_override_assert_false.c 2024-04-22 20:12:15.000000000 +0200 +++ new/aws-c-common-0.9.19/verification/cbmc/stubs/abort_override_assert_false.c 2024-05-11 01:22:14.000000000 +0200 @@ -11,6 +11,6 @@ #include <assert.h> -void abort() { +void abort(void) { assert(0); }
