Debian Codegraph @

crt/aws-c-common/verification/cbmc/proofs/memset_override_0/memset_override_0_harness.c

raw symbols SCIP
1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <proof_helpers/utils.h>
7 #include <stddef.h>
8
9 void *memset_impl(void *dst, int c, size_t n);
10 void *memset_override_0_impl(void *dst, int c, size_t n);
11
12 /*
13 * Check that the optimized version of memset is memory safe
14 * And that it matches the naive version
15 */
16 void memset_override_0_harness() {
17
18 short d1[MAX];
19 short d2[MAX];
20 int c;
21 __CPROVER_assume(c == 0); // asserted in the implementation
22
23 unsigned size;
24 __CPROVER_assume((size & 0x7) == 0); // asserted in the implementation
25 __CPROVER_assume(size < MAX);
26 memset_impl(d1, c, size);
27 memset_override_0_impl(d2, c, size);
28 assert_bytes_match((uint8_t *)d1, (uint8_t *)d2, size);
29 assert_all_bytes_are((uint8_t *)d2, c, size);
30 }