emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

Randomly occurring libpng bug in png_read_IDAT_data

Open curiousdannii opened this issue 1 month ago • 2 comments

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.59 (0e4c5994eb5b8defd38367a416d0703fd506ad81)
clang version 19.0.0git (https:/github.com/llvm/llvm-project df762a1643bb5b0b3c907611d118c82d4b68a39d)

I've found a randomly occurring bug. I uploaded a good build to https://curiousdannii.github.io/infocom-frotz/sfrotz.html?story=shogun, which successfully shows the title graphic. But most of the time when I build my app, I get errors in png_read_IDAT_data. To be clear, the randomness is at compilation time - once compiled it either always works or never does.

My code is at https://github.com/curiousdannii/infocom-frotz Run ./build.sh to build it, or rm frotz/sfrotz.js && ./build.sh to relink it. It actually appears that the randomness is happening at the linking stage, as simply running the linker like that is enough to switch between working and broken builds.

I was at my wit's end, even trying to rebuild libpng from source, unless I noticed that just occasionally it does work. Then I was at least a little relieved that if the compiler/linker isn't being consistent it's probably not my fault.

I'll attach two zips of the working and broken output, in case inspecting the .wasm would help.

dist-broken.zip dist-working.zip

curiousdannii avatar May 13 '24 02:05 curiousdannii