Skip to content

Commit

Permalink
suppress erroneous outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
smittals2 committed Jan 28, 2025
1 parent c951f1e commit e59eb6b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
4 changes: 1 addition & 3 deletions crypto/base64/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@

// constant_time_lt_args_8 behaves like |constant_time_lt_8| but takes |uint8_t|
// arguments for a slightly simpler implementation.
#if defined(__clang__)
__attribute__((no_sanitize("unsigned-integer-overflow")))
#endif
SUPPRESS_UNSIGNED_OVERFLOW
static inline uint8_t constant_time_lt_args_8(uint8_t a, uint8_t b) {
crypto_word_t aw = a;
crypto_word_t bw = b;
Expand Down
1 change: 1 addition & 0 deletions crypto/bytestring/cbb.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ int CBB_did_write(CBB *cbb, size_t len) {
return 1;
}

SUPPRESS_UNSIGNED_OVERFLOW
static int cbb_add_u(CBB *cbb, uint64_t v, size_t len_len) {
uint8_t *buf;
if (!CBB_add_space(cbb, &buf, len_len)) {
Expand Down
6 changes: 6 additions & 0 deletions crypto/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ typedef __uint128_t uint128_t;
#define OPENSSL_HAS_BUILTIN(x) 0
#endif

#if defined(__clang__)
#define SUPPRESS_UNSIGNED_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow")))
#else
#define SUPPRESS_UNSIGNED_OVERFLOW
#endif

// Pointer utility functions.

Expand Down Expand Up @@ -339,6 +344,7 @@ static inline uint64_t value_barrier_u64(uint64_t a) {

// constant_time_msb_w returns the given value with the MSB copied to all the
// other bits.
SUPPRESS_UNSIGNED_OVERFLOW
static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
return 0u - (a >> (sizeof(a) * 8 - 1));
}
Expand Down
6 changes: 6 additions & 0 deletions ssl/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3720,6 +3720,12 @@ struct ssl_method_st {
const bssl::SSL_X509_METHOD *x509_method;
};

#if defined(__clang__)
#define SUPPRESS_UNSIGNED_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow")))
#else
#define SUPPRESS_UNSIGNED_OVERFLOW
#endif

#define MIN_SAFE_FRAGMENT_SIZE 512
struct ssl_ctx_st : public bssl::RefCounted<ssl_ctx_st> {
explicit ssl_ctx_st(const SSL_METHOD *ssl_method);
Expand Down
1 change: 1 addition & 0 deletions ssl/ssl_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void SSLBuffer::Clear() {
buf_size_ = 0;
}

SUPPRESS_UNSIGNED_OVERFLOW
bool SSLBuffer::EnsureCap(size_t header_len, size_t new_cap) {
if (new_cap > SSLBUFFER_MAX_CAPACITY) {
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
Expand Down

0 comments on commit e59eb6b

Please sign in to comment.