Bill Allombert on Thu, 16 Feb 2012 16:04:36 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

bug in gp_initrc (for empty line)


Dear PARI developers,

Xavier has found a bug in gp_initrc, when the .gprc file has an empty line:

We do
    s = b->buf;
    /* remove trailing \n */
    slen = strlen(s);
    if (s[slen-1] == '\n') s[slen-1] = 0;

When the line is empty, s is the empty string and does no have a trailing '\n',
so slen is 0 and so s[slen-1] is invalid.

It is not clear why a trailing '\n' is expected.

Cheers,
Bill.