Skip to content

UBSanitizer runtime error: left shift of negative value -1 #5395

Description

static RD_INLINE RD_UNUSED size_t rd_uvarint_enc_i64(char *dst,
size_t dstsize,
int64_t num) {
return rd_uvarint_enc_u64(dst, dstsize, (num << 1) ^ (num >> 63));
}

Activity

  1. marlowa commented on Apr 22, 2026

    @marlowa

    which sanitizer is this you are using? Address? Or thread?
    I am trying to use the thread sanitizer on a C++ program that uses librdkafka and it gets a SEGV as soon as the kafka background threads start. It blows up in a call get getaddrinfo when it tries to get the broker IP addresses from their names via DNS lookup.

  2. Ignition commented on Apr 22, 2026

    @Ignition
    Author

    Andrew Peter Marlow (@marlowa) this was with undefined behaviour sanitizer.
    -fsanitize=undefined

    ATM there are 3 different areas that we currently have to suppress when building with sanitizers.

    # librdkafka: left shift of negative value in zig-zag varint encoder (rdvarint.h:71)
    src:*/rdvarint.h
    
    # librdkafka: signed integer overflow in timestamp conversion (rdkafka_int.h:1171)
    src:*/rdkafka_int.h
    
    # librdkafka: negative shift exponent in HDR histogram (rdhdrhistogram.c:212)
    src:*/rdhdrhistogram.c
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions