Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protect against undefined behavior from inputs like "NaN"
Reproducer was (against commit 07ce2f9 on master): > # make clean all {C,LD}FLAGS='-fsanitize=undefined -fno-sanitize-recover=all' \ > && ./ttyplot <<<NaN |& tee /tmp/foo \ > && reset \ > && grep -oE ttyplot\.c.+ /tmp/foo With GCC you would get: > ttyplot.c:129:9: runtime error: signed integer overflow: 0 - -2147483648 cannot be represented in type 'int' With Clang you would get: > ttyplot.c:144:58: runtime error: nan is outside the range of representable values of type 'int'
- Loading branch information