View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum ↗

iraf-v216 · Code · Issues (50) · Pull requests (81)

iraf.net pull request #121

Fix isalnum() and friends for non-ascii values

merge olebole merged 1 commit to iraf-community/iraf


olebole commented on 2017-12-09

When one enters a non-ASCII character at the ECL input line, IRAF gets very confused and answers with an endless “Segmentation fault” loop (on Linux 64 bit). This is due to an errornous handling of isalnum(), called in lexicon.c: The int value is converted to unsigned, and then looked up in a char[129] array. For non-ASCII values, this results in a number outside of this range, followed by a segfault.

Any test that uses this array should ensure that the argument is in this range. This is now done by preceding all tests with isascii(c) &&. Do avoid side effects by using the argument twice, the macros are converted into normal functions.

This solution basically means that everything above 127 is neither a alphabetical value nor a punctuation mark; not even printable. However, the tests in this range are locale specific, which is not handled anyway by IRAF.

The best solution here would however be to rely on the system libc isXXXXX() tests; however they may be defined as macros in /usr/include/ctype.h, which makes it difficult to include in an IRAF libc function.

With this patch, you can do “nicely”

ecl> grönland  
**: grönland  
              ^  
ERROR: syntax error  
ecl>   

Which is great for people like me who sometimes hit the wrong key on a non-US keyboardä.


Commits


Last updated on 2017-12-09