SFML community forums

Help => Graphics => Topic started by: D on January 15, 2012, 01:13:11 am

Title: Double-free bug in SFML2 (at least on OS X)
Post by: D on January 15, 2012, 01:13:11 am
Hi. I compiled SFML2 main branch (from github) today, and discovered a bug that is caused by freeing a non-allocated pointer. The bug occurs after initializing a empty sf::String and when the program is calling its destructor:
Code: [Select]
#include <SFML/System.hpp>
int main()
{
    sf::String s;
    return 0;
}

Code: [Select]
~ ยป ./a.out                                                    
a.out(27893) malloc: *** error for object 0x100035300: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug


I did a quick glance through SFML's source code, but discovered nothing suspicious. sf::String is just a wrapper around std::basic_string<Uint32> after all...
I'm running OS X 10.6.8, SFML and the executable is in x86_64. Compiling the program in i386 architecture made no difference. I haven't been able to test this on other machines yet.
Title: Double-free bug in SFML2 (at least on OS X)
Post by: Oberon on January 15, 2012, 09:33:11 am
It's a known bug, but it seems to be Apple's fault: https://github.com/SFML/SFML/issues/5
Title: Double-free bug in SFML2 (at least on OS X)
Post by: Hiura on January 15, 2012, 10:34:37 am
Yes, this is indeed issue #5. I just added some more information and a solution to the issue on github.

But still no news from Apple one year after filling a bug repport...
Title: Double-free bug in SFML2 (at least on OS X)
Post by: D on January 15, 2012, 11:18:44 am
Thanks for replies. I didn't go through the issues list, sorry about that. Good to know that the problem lies in Apple's side, although it may take a long time before they will fix it, or if they will...