[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

clang's memory sanitizer triggers in freea()

From: Tim Rühsen
Subject: clang's memory sanitizer triggers in freea()
Date: Fri, 21 Jul 2017 16:32:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1


I am trying to use clang's address sanitizer on libidn2.

It finds the use of uninitialized stack memory in malloca.c/freea()
(latest gnulib sources).

It is this line which causes problems:

      if (((int *) p)[-1] == MAGIC_NUMBER)

Is there anything that can/should be done in the code ?

Maybe using clang's __attribute__((no_sanitize("memory"))) (see
https://clang.llvm.org/docs/MemorySanitizer.html#handling-external-code) ?

Or is it even a false positive that should be addressed at llvm/clang ?

The trace is

==685==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7fcb2c841ba8 in freea
    #1 0x7fcb2c851b44 in mem_iconveha
    #2 0x7fcb2c854ea2 in u8_conv_from_encoding
    #3 0x7fcb2c855336 in u8_strconv_from_encoding
    #4 0x7fcb2c8557a4 in u8_strconv_from_locale
    #5 0x7fcb2c82e546 in idn2_register_ul
    #6 0x48f256 in main /usr/oms/src/libidn2/tests/test-register.c:187:13
    #7 0x7fcb2b9592b0 in __libc_start_main
    #8 0x419b79 in _start

SUMMARY: MemorySanitizer: use-of-uninitialized-value
/usr/oms/src/libidn2/unistring/malloca.c:134:11 in freea

With Best Regards, Tim

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]