zeux wrote: This change leads to a miscompilation; I've extracted a somewhat minimal repro case from the referenced issue above, in the comment: https://github.com/zeux/pugixml/issues/629#issuecomment-2346839855
The code, when compiled with `-O2 -g` by latest clang on Linux/X64, generates the following assembly after the call to `printf` in `get_valid_length`: ``` -> 0x555555561270 <+192>: movzx eax, byte ptr [-0x1] ``` ... which, as you can imagine, results in a sigsegv :) This seems to be architecture independent as it initially reproduced in Wasm and also confirmed on Arm. I *believe* that all accesses in this code are in-bounds and no overflow/underflow happens. The code is silent with `-fsanitize=integer,undefined` when using clang 18. https://github.com/llvm/llvm-project/pull/107257 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits