Karim Belabas on Thu, 16 Feb 2012 16:18:02 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: bug in gp_initrc (for empty line) |
* Bill Allombert [2012-02-16 16:04]: > 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. This had been detected as part of my short valgrind tutorial, during last month's Atelier in Bordeaux... For some reason, I had forgotten to commit the patch written after the tutorial. Done now. Thanks for the reminder ! :-) K.B. -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50 351, cours de la Liberation http://www.math.u-bordeaux1.fr/~belabas/ F-33405 Talence (France) http://pari.math.u-bordeaux1.fr/ [PARI/GP] `