Hi Wilko,
you are perfectly right, and the info you sent were absolutely complete.
Fortunately that string class does index checkings, otherwise we could
have ugly behaviors instead of an abort().
I just fixed the bug, let me know.
Fabrizio
Wilko Kroeger wrote:
> Hello Fabrizio
>
> We found that a core is produced if the function
> XrdClientAdmin_c::XrdDirList(const char *dir)
> is called and the directory for which we want to get the
> listing is empty.
>
> In this case the call to
> adminst->DirList(dir, entries) in XrdClientAdmin_c::XrdDirList
> returns an empty vector (entries) and the call
> joinStrings(lst, entries);
> crashes because joinStrings can not handle
> an empty vector. At least that's what it looks to me.
>
>
> The test program that I run is:
>
> #include "XrdClient/XrdClient.hh"
> #include "XrdClient/XrdClientAdmin_c.hh"
> #include <iostream>
>
> int main(int argc, char **argv) {
> XrdInitialize(argv[1], 2);
> char *strans;
> strans = XrdDirList("/prod/s1/s2/s3/s5");
> cout << "answer : " << strans endl;
> XrdTerminate();
> }
>
> and the core is:
>
> (gdb) where
> #0 0x005cbcdf in raise () from /lib/tls/libc.so.6
> #1 0x005cd4e5 in abort () from /lib/tls/libc.so.6
> #2 0x0804d15e in XrdClientString::At(int) (this=0xbfff9af0, pos=-1)
> at XrdClientString.hh:103
> #3 0x0804cfab in XrdClientString::operator[](int) (this=0xbfff9af0, pos=-1)
> at XrdClientString.hh:213
> #4 0x0804de78 in joinStrings(XrdClientString&, XrdClientVector<XrdClientString>)
> (buf=@0xbfff9af0, vs={data = 0x0, size = 0, capacity = 0})
> at XrdClientAdmin.cc:46
> #5 0x0804c601 in XrdDirList (dir=0x8071228 "/prod/s1/s2/s3/s5")
> at XrdClientAdmin_c.cc:230
> #6 0x0804b9c1 in main (argc=2, argv=0xbfff9bd4) at TestXrdClient.cc:26
>
>
>
> The xrootd version is 20041220-1337.
>
> Thanks,
> Wilko
|