Seg fault in readline() method in wcc_tfilter.c
Opened this issue · 0 comments
scallag commented
When running the unit tests on OLCF Summit, a seg fault occurs on line 406:
*ptr++ = c;
I believe this is because C type 'char' on Summit defaults to 'unsigned char', but EOF is defined as -1, so an unsigned char will never be equal to EOF. Therefore, the while loop in line 400 will never exit, and eventually ptr will overflow far enough to cause a seg fault.
Potential solutions include changing c to a signed char (which can hold any ASCII filenames), testing the file pointer for EOF rather than the character, or changing from readline() to a more standard C function such as fscanf().