From: <ro...@li...> - 2004-04-24 13:23:24
|
Hi, > Here's the problem: TiLP 6.71 segfaults whenever it encounters a file > *that might be a valid TI file, but has no extension.* Could you tell me how to reproduce the problem ? I attempted to create a=20 'foo' file but TiLP did not crash. >=20 > In this case, the function tifiles_get_extension() returns NULL, and > tifiles_is_a_tib_file() then proceeds to compare NULL with "tib." I > guess this counts as a bug in libtifiles, but in fact it was there in > previous versions of the library. >=20 > The difference is that in previous versions of TiLP, > tifiles_is_a_xxx_file (for xxx =3D group, backup, flash, tib) was only > ever called after the extension had already been checked. In version > 6.71, tifiles_is_a_tib_file is called for every file in the directory, > as part of clist_refresh(). >=20 > So my solution is to add the check to each of the four > tifiles_is_a_xxx_file functions: if there is no extension, the file > isn't valid no matter what it looks like. >=20 > Here's a patch, hoping it works... Thanks. I will apply it as soon as I would have able to reproduce bug.=20 To be sure ! >=20 > diff -u libtifiles-0.5.8/src/typesxx.c libtifiles-0.5.8-patch/src/types= xx.c > --- libtifiles-0.5.8/src/typesxx.c 2004-04-17 06:55:45.000000000 -0400 > +++ libtifiles-0.5.8-patch/src/typesxx.c 2004-04-22 20:16:23.000000000 = -0400 > @@ -788,6 +788,9 @@ > int i; > char *e =3D tifiles_get_extension(filename); > =20 > + if (e=3D=3DNULL) > + return 0; > + > if (!tifiles_is_a_ti_file(filename)) > return 0; > =20 > @@ -823,6 +826,9 @@ > int i; > char *e =3D tifiles_get_extension(filename); > =20 > + if (e=3D=3DNULL) > + return 0; > + > if (!tifiles_is_a_ti_file(filename)) > return 0; > =20 > @@ -844,6 +850,9 @@ > int i; > char *e =3D tifiles_get_extension(filename); > =20 > + if (e=3D=3DNULL) > + return 0; > + > if (!tifiles_is_a_ti_file(filename)) > return 0; > =20 > @@ -865,6 +874,9 @@ > { > char *e =3D tifiles_get_extension(filename); > =20 > + if (e=3D=3DNULL) > + return 0; > + > if (!tifiles_is_a_ti_file(filename)) > return 0; > =20 >=20 > Benjamin Moody >=20 >=20 thx, roms. --=20 Romain Li=E9vin (roms): <ro...@ti...> Web site: http://www.lievin.net "Linux, y'a moins bien mais c'est plus cher !" |