Skip to content

Segfault in Bt3Zip_MatchFinder_GetMatches2 on all PNG files when compression level >= 2 and compiled with GCC 15 with -O3 or higher #145

@afontenot

Description

@afontenot

I've been using ect for years on this system, with no issue, but recently all PNG files starting crashing ect. I don't see a crash when ect is compiled with clang 20.1.8 or gcc 14.3.1. The system version of gcc is 15.1.1, and using it results in a segfault.

Optimizing at -O2 does not cause the segfault, optimizing at -O3 does.

Backtrace:

#0  0x0000555555563629 in Bt3Zip_MatchFinder_GetMatches2 ()
#1  0x00005555555a3e35 in GetBestLengths.isra.0 ()
#2  0x00005555555a4c61 in ZopfliLZ77Optimal2 ()
#3  0x000055555559e9aa in ZopfliDeflate ()
#4  0x0000555555564426 in CustomPNGDeflate(unsigned char**, unsigned long*, unsigned char const*, unsigned long, LodePNGCompressSettings const*) ()
#5  0x0000555555578f85 in lodepng_zlib_compress(unsigned char**, unsigned long*, unsigned char const*, unsigned long, LodePNGCompressSettings const*) [clone .constprop.0] ()
#6  0x0000555555581b0f in lodepng_encode(unsigned char**, unsigned long*, unsigned char const*, unsigned int, unsigned int, LodePNGState*, LodePNGPaletteSettings) ()
#7  0x000055555558e010 in lodepng::encode(std::vector<unsigned char, std::allocator<unsigned char> >&, unsigned char const*, unsigned long, unsigned int, unsigned int, lodepng::State&, LodePNGPaletteSettings) ()
#8  0x000055555556500b in Zopflipng(bool, char const*, bool, unsigned int, int, unsigned int, unsigned int) ()
#9  0x000055555555e00e in fileHandler(char const*, ECTOptions const&, int) ()
#10 0x000055555555b9b3 in main ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions