It seems that stbi_zlib_compress causes this segfault while saving an image as png. When I use jpg it works fine.
Here's the gdb trace:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff79601cf in stbi_zlib_compress(unsigned char*, int, int*, int) ()
from /usr/lib/libsfml2-graphics.so
(gdb) bt
#0 0x00007ffff79601cf in stbi_zlib_compress(unsigned char*, int, int*, int) ()
from /usr/lib/libsfml2-graphics.so
#1 0x00007ffff79612f9 in stbi_write_png_to_mem(unsigned char*, int, int, int, int, int*) ()
from /usr/lib/libsfml2-graphics.so
#2 0x00007ffff7961592 in stbi_write_png () from /usr/lib/libsfml2-graphics.so
#3 0x00007ffff7961c4b in sf::priv::ImageLoader::SaveImageToFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int, unsigned int) () from /usr/lib/libsfml2-graphics.so
I'm working on a 64bit Arch Linux Laptop but it fails also on other systems.