Hi,

When compiling faust with -fsanitizer=address (asan), I get this crash:

==6397==ERROR: AddressSanitizer: heap-use-after-free on address
0x612000434a40 at pc 0x7ffff70e074d bp 0x7fffffff9ed0 sp 0x7fffffff9680
READ of size 3 at 0x612000434a40 thread T0
    #0 0x7ffff70e074c in __interceptor_setlocale
../../.././libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:2264
    #1 0xe70244 in global::~global()
/home/kjetil/faust2/compiler/global.cpp:397
    #2 0xe711a9 in global::destroy()
/home/kjetil/faust2/compiler/global.cpp:415

...

0x612000434a40 is located 0 bytes inside of 271-byte region
[0x612000434a40,0x612000434b4f)
freed by thread T0 here:
    #0 0x7ffff7124d7a in __interceptor_free
../../.././libsanitizer/asan/asan_malloc_linux.cc:28
    #1 0x3b4942c155 in __GI_setlocale (/lib64/libc.so.6+0x3b4942c155)
    #2 0x7ffff70e065b in __interceptor_setlocale
../../.././libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:2265
    #3 0xe6ff94 in global::init()
/home/kjetil/faust2/compiler/global.cpp:383


Seems like a subsequent call to setlocale frees the previous result from it.
This patch seems like the easiest fix:


[kjetil@ttlush faust2]$ diff -u compiler/global.cpp~ compiler/global.cpp
--- compiler/global.cpp~    2016-06-08 13:36:37.000000000 +0200
+++ compiler/global.cpp    2016-06-10 09:44:05.770369357 +0200
@@ -380,7 +380,7 @@
     gCurrentLocal = setlocale(LC_ALL, NULL);
     // Setup standard "C" local
     // (workaround for a bug in bitcode generation :
http://lists.cs.uiuc.edu/pipermail/llvmbugs/2012-May/023530.html)
-    setlocale(LC_ALL, "C");
+    gCurrentLocal = setlocale(LC_ALL, "C");

     gAllocationCount = 0;
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Faudiostream-devel mailing list
Faudiostream-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-devel

Reply via email to