Avoid call to isgraph if value returned from getopt_long exceeds that of the max value that can be stored in unsigned char.
Avoid call to isgraph if value returned from getopt_long exceeds that of the max value that can be stored in unsigned char.

The return value of isgraph(int ch) is undefined if ch is not representable as an unsigned char: https://en.cppreference.com/w/cpp/string/byte/isgraph. This change fixes an issue where calls to isgraph for the value returned by getopt_long for the long form of some options would return nonzero.

This change is inspired by segfaults caused by glibc-2.27 returning large (undefined) values instead of the (undefined) glibc-2.19 behavior of just returning 0. Checking whether the value is below 255 is the right thing to do.

Original-by: Jake Riley

google/neper