Boost logo

Boost :

Subject: Re: [boost] Double free from UTF
From: Dmitry V. Krivenok (krivenok_at_[hidden])
Date: 2009-09-22 09:30:18


janm-boost-devel_at_[hidden] wrote:
> Hi,
>
> I am seeing a double free when using boost-test on:
>
> - FreeBSD 7.2-STABLE, amd64 (gcc 4.2.1) with boost 1.39
> - Mac OSX 10.6.1, x86_64 (XCode 3.2, gcc 4.2) with boost 1.40

Hi!

I tried your example on 32bit Linux with boost 1.38 and 1.40
and gcc 4.4.1, 4.3.2 and 4.1.2.
Everything works fine.
Results are:

krivenok_at_develop2 17:22:16 /tmp/test_bug $ cat test.cpp
#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp>
#include <stdlib.h>

const char* _malloc_options = "J";

BOOST_AUTO_TEST_CASE(broken)
{
   BOOST_CHECK(true);
}
krivenok_at_develop2 17:22:31 /tmp/test_bug $ g++-4.4.1 -Wall -I
/usr/local/dev/boost-1.40.0/include/ test.cpp -o test
krivenok_at_develop2 17:22:45 /tmp/test_bug $ ./test
Running 1 test case...

*** No errors detected
krivenok_at_develop2 17:22:48 /tmp/test_bug $ g++-4.3.2 -Wall -I
/usr/local/dev/boost-1.40.0/include/ test.cpp -o test
krivenok_at_develop2 17:23:02 /tmp/test_bug $ ./test
Running 1 test case...

*** No errors detected
krivenok_at_develop2 17:23:04 /tmp/test_bug $ g++-4.1.2 -Wall -I
/usr/local/dev/boost-1.40.0/include/ test.cpp -o test
krivenok_at_develop2 17:23:16 /tmp/test_bug $ ./test
Running 1 test case...

*** No errors detected
krivenok_at_develop2 17:23:18 /tmp/test_bug $ g++-4.4.1 -Wall -I
/usr/local/dev/boost-1.38.0/include/ test.cpp -o test
/usr/local/dev/boost-1.38.0/include/boost/test/floating_point_comparison.hpp:224:
warning: 'boost::test_tools::<unnamed>::check_is_close' defined but not used
/usr/local/dev/boost-1.38.0/include/boost/test/floating_point_comparison.hpp:246:
warning: 'boost::test_tools::<unnamed>::check_is_small' defined but not used
krivenok_at_develop2 17:23:41 /tmp/test_bug $ ./test
Running 1 test case...

*** No errors detected
krivenok_at_develop2 17:23:43 /tmp/test_bug $ g++-4.3.2 -Wall -I
/usr/local/dev/boost-1.38.0/include/ test.cpp -o test
/usr/local/dev/boost-1.38.0/include/boost/test/floating_point_comparison.hpp:224:
warning: 'boost::test_tools::<unnamed>::check_is_close' defined but not used
/usr/local/dev/boost-1.38.0/include/boost/test/floating_point_comparison.hpp:246:
warning: 'boost::test_tools::<unnamed>::check_is_small' defined but not used
krivenok_at_develop2 17:23:54 /tmp/test_bug $ ./test
Running 1 test case...

*** No errors detected
krivenok_at_develop2 17:23:56 /tmp/test_bug $ g++-4.1.2 -Wall -I
/usr/local/dev/boost-1.38.0/include/ test.cpp -o test
krivenok_at_develop2 17:24:10 /tmp/test_bug $ ./test
Running 1 test case...

*** No errors detected
krivenok_at_develop2 17:24:15 /tmp/test_bug $

I will try it on amd64 later.

>
> I don't see the problem on Windows XP with Visual C++ 2005 Express.
>
> A simple test case is below, just run. The _malloc_options is to make
> the system malloc() fill memory with 0xa5 on allocation and 0x5a on
> deallocation.
>
> #define BOOST_TEST_MAIN
> #include <boost/test/included/unit_test.hpp>
> #include <stdlib.h>
>
> const char* _malloc_options = "J";
>
> BOOST_AUTO_TEST_CASE(broken)
> {
> BOOST_CHECK(true);
> }
>
> Output:
>
> Running 1 test case...
>
> *** No errors detected
> zsh: bus error (core dumped) ./a.out
>
> Stack Trace:
>
> #0 0x0000000800b1bdee in free () from /lib/libc.so.7
> #1 0x000000000043e51c in boost::unit_test::framework_impl::clear (this=0x55ad20) at framework.ipp:133
> #2 0x000000000043e652 in ~framework_impl (this=0x55ad20) at framework.ipp:122
> #3 0x00000000004110c6 in __tcf_1 () at framework.ipp:222
> #4 0x0000000800b6dbb6 in __cxa_finalize () from /lib/libc.so.7
> #5 0x0000000800b1f7c7 in exit () from /lib/libc.so.7
> #6 0x0000000000404595 in _start ()
>
> Any ideas?
>
> Thanks,
>
> Jan Mikkelsen
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk