The line https://github.com/esheldon/pymangle/blob/master/pymangle/polygon.c#L279
nread = getline(&linebuf, &n, fptr);
n is set to the size of the buffer originally allocated by getline, not the size of the buffer actually read.
The return value nread is the actual number of characters read.
Using n when parsing the line with
get_next_nonblank(linebuf, n, i) or et_next_nonblank(linebuf, n, i)
will go beyond the end of the line (for some reason this is not caught)
to allocated, but un-initialized memory.
This can be prevented by replacing n by nread in the appropriate places.
The line https://github.com/esheldon/pymangle/blob/master/pymangle/polygon.c#L279 nread = getline(&linebuf, &n, fptr); n is set to the size of the buffer originally allocated by getline, not the size of the buffer actually read. The return value nread is the actual number of characters read. Using n when parsing the line with get_next_nonblank(linebuf, n, i) or et_next_nonblank(linebuf, n, i) will go beyond the end of the line (for some reason this is not caught) to allocated, but un-initialized memory. This can be prevented by replacing n by nread in the appropriate places.