From Matthew Straits:
From Matthew Straits:

This fixes <http://savannah.cern.ch/patch/?5439>.

I have a partially written file that ROOT crashes on when I try to read it,
e.g. by Add()ing it to a TChain and then calling GetEntries().  The output
is:

 Error in <TBasket::ReadObjWithBuffer>: Unknown class 
 Error in <TBasket::ReadObjWithBuffer>: Unknown class 

 *** Break *** segmentation violation

I have traced this to a single line in TFile where there is an unchecked
cast.  Here is the fix:


+++ io/io/src/TFile.cxx	(working copy)
@@ -1243,7 +1243,7 @@
          return 0;
       }
       key->ReadKeyBuffer(buf);
-      list = (TList*)key->ReadObjWithBuffer(buffer);
+      list = dynamic_cast<TList*>(key->ReadObjWithBuffer(buffer));
       if (list) list->SetOwner();
       delete [] buffer;
       delete key;


Now the output is:

Info in <TFile::GetStreamerInfoList>: cannot find the StreamerInfo record in
file broken.root

There is no segfault and the rest of the TChain (in my example) can be read. 
I'm not sure that an Info message is really sufficient to inform the user that
an input file isn't being read, but it's better than crashing, at least.


git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@44710 27541ba8-7e3a-0410-8455-c3a389f83636

beniz/root,davidlt/root,omazapa/root-old,mattkretz/root,arch1tect0r/root,dfunke/root,karies/root,lgiommi/root,satyarth934/root,root-mirror/root,bbockelm/root,perovic/root,cxx-hep/root-cern,omazapa/root-old,sirinath/root,lgiommi/root,beniz/root,CristinaCristescu/root,gganis/root,BerserkerTroll/root,dfunke/root,nilqed/root,omazapa/root-old,zzxuanyuan/root-compressor-dummy,Y--/root,krafczyk/root,mhuwiler/rootauto,mhuwiler/rootauto,sirinath/root,mkret2/root,smarinac/root,abhinavmoudgil95/root,karies/root,gganis/root,arch1tect0r/root,nilqed/root,omazapa/root,gbitzes/root,agarciamontoro/root,sbinet/cxx-root,Y--/root,jrtomps/root,cxx-hep/root-cern,olifre/root,sawenzel/root,lgiommi/root,sbinet/cxx-root,beniz/root,dfunke/root,esakellari/my_root_for_test,CristinaCristescu/root,dfunke/root,mkret2/root,nilqed/root,olifre/root,georgtroska/root,veprbl/root,vukasinmilosevic/root,arch1tect0r/root,zzxuanyuan/root,omazapa/root,georgtroska/root,0x0all/ROOT,Y--/root,bbockelm/root,mattkretz/root,karies/root,omazapa/root,evgeny-boger/root,root-mirror/root,lgiommi/root,BerserkerTroll/root,sirinath/root,mattkretz/root,lgiommi/root,nilqed/root,mkret2/root,sawenzel/root,bbockelm/root,simonpf/root,Duraznos/root,satyarth934/root,simonpf/root,thomaskeck/root,cxx-hep/root-cern,sawenzel/root,olifre/root,smarinac/root,Duraznos/root,sirinath/root,karies/root,olifre/root,gganis/root,vukasinmilosevic/root,BerserkerTroll/root,gbitzes/root,cxx-hep/root-cern,BerserkerTroll/root,dfunke/root,karies/root,nilqed/root,buuck/root,davidlt/root,CristinaCristescu/root,sawenzel/root,georgtroska/root,mhuwiler/rootauto,krafczyk/root,mkret2/root,arch1tect0r/root,zzxuanyuan/root-compressor-dummy,dfunke/root,mattkretz/root,smarinac/root,mattkretz/root,beniz/root,davidlt/root,alexschlueter/cern-root,mhuwiler/rootauto,satyarth934/root,perovic/root,zzxuanyuan/root,agarciamontoro/root,agarciamontoro/root,beniz/root,bbockelm/root,georgtroska/root,omazapa/root,esakellari/root,evgeny-boger/root,krafczyk/root,nilqed/root,jrtomps/root,esakellari/root,karies/root,Y--/root,georgtroska/root,zzxuanyuan/root,georgtroska/root,veprbl/root,agarciamontoro/root,arch1tect0r/root,lgiommi/root,davidlt/root,esakellari/root,georgtroska/root,jrtomps/root,root-mirror/root,zzxuanyuan/root-compressor-dummy,krafczyk/root,esakellari/my_root_for_test,BerserkerTroll/root,evgeny-boger/root,zzxuanyuan/root-compressor-dummy,vukasinmilosevic/root,Duraznos/root,satyarth934/root,bbockelm/root,sbinet/cxx-root,smarinac/root,vukasinmilosevic/root,evgeny-boger/root,BerserkerTroll/root,georgtroska/root,CristinaCristescu/root,jrtomps/root,Y--/root,simonpf/root,gbitzes/root,cxx-hep/root-cern,esakellari/root,beniz/root,evgeny-boger/root,evgeny-boger/root,esakellari/my_root_for_test,sirinath/root,esakellari/my_root_for_test,zzxuanyuan/root,bbockelm/root,perovic/root,bbockelm/root,beniz/root,sbinet/cxx-root,buuck/root,thomaskeck/root,satyarth934/root,simonpf/root,olifre/root,jrtomps/root,pspe/root,mhuwiler/rootauto,krafczyk/root,esakellari/root,alexschlueter/cern-root,zzxuanyuan/root-compressor-dummy,simonpf/root,mattkretz/root,perovic/root,0x0all/ROOT,pspe/root,0x0all/ROOT,0x0all/ROOT,sawenzel/root,Y--/root,mkret2/root,zzxuanyuan/root,veprbl/root,beniz/root,bbockelm/root,esakellari/my_root_for_test,sbinet/cxx-root,arch1tect0r/root,pspe/root,sbinet/cxx-root,krafczyk/root,lgiommi/root,georgtroska/root,sirinath/root,agarciamontoro/root,Y--/root,beniz/root,omazapa/root-old,Duraznos/root,veprbl/root,CristinaCristescu/root,georgtroska/root,buuck/root,zzxuanyuan/root-compressor-dummy,alexschlueter/cern-root,abhinavmoudgil95/root,abhinavmoudgil95/root,alexschlueter/cern-root,perovic/root,arch1tect0r/root,agarciamontoro/root,dfunke/root,krafczyk/root,sirinath/root,Y--/root,smarinac/root,nilqed/root,satyarth934/root,root-mirror/root,omazapa/root-old,vukasinmilosevic/root,buuck/root,CristinaCristescu/root,mkret2/root,mkret2/root,omazapa/root-old,abhinavmoudgil95/root,nilqed/root,Duraznos/root,root-mirror/root,sirinath/root,CristinaCristescu/root,mhuwiler/rootauto,CristinaCristescu/root,esakellari/root,satyarth934/root,smarinac/root,zzxuanyuan/root,pspe/root,agarciamontoro/root,CristinaCristescu/root,buuck/root,esakellari/my_root_for_test,thomaskeck/root,veprbl/root,abhinavmoudgil95/root,abhinavmoudgil95/root,evgeny-boger/root,zzxuanyuan/root,bbockelm/root,jrtomps/root,Duraznos/root,krafczyk/root,gganis/root,Duraznos/root,abhinavmoudgil95/root,BerserkerTroll/root,mattkretz/root,sawenzel/root,simonpf/root,vukasinmilosevic/root,gbitzes/root,karies/root,evgeny-boger/root,omazapa/root-old,pspe/root,abhinavmoudgil95/root,zzxuanyuan/root,sbinet/cxx-root,Duraznos/root,smarinac/root,arch1tect0r/root,thomaskeck/root,zzxuanyuan/root-compressor-dummy,sawenzel/root,esakellari/root,BerserkerTroll/root,veprbl/root,CristinaCristescu/root,krafczyk/root,dfunke/root,krafczyk/root,buuck/root,jrtomps/root,lgiommi/root,root-mirror/root,0x0all/ROOT,smarinac/root,simonpf/root,krafczyk/root,gbitzes/root,agarciamontoro/root,esakellari/root,zzxuanyuan/root-compressor-dummy,mhuwiler/rootauto,arch1tect0r/root,CristinaCristescu/root,veprbl/root,satyarth934/root,cxx-hep/root-cern,buuck/root,Y--/root,dfunke/root,gganis/root,alexschlueter/cern-root,davidlt/root,perovic/root,mkret2/root,lgiommi/root,mkret2/root,esakellari/root,omazapa/root-old,smarinac/root,cxx-hep/root-cern,omazapa/root,mhuwiler/rootauto,perovic/root,karies/root,gbitzes/root,lgiommi/root,Duraznos/root,sawenzel/root,zzxuanyuan/root-compressor-dummy,perovic/root,esakellari/root,gbitzes/root,abhinavmoudgil95/root,thomaskeck/root,jrtomps/root,mhuwiler/rootauto,pspe/root,perovic/root,esakellari/my_root_for_test,sbinet/cxx-root,zzxuanyuan/root,olifre/root,alexschlueter/cern-root,davidlt/root,sbinet/cxx-root,abhinavmoudgil95/root,gbitzes/root,omazapa/root,omazapa/root-old,buuck/root,sirinath/root,0x0all/ROOT,thomaskeck/root,thomaskeck/root,lgiommi/root,pspe/root,davidlt/root,pspe/root,pspe/root,vukasinmilosevic/root,Duraznos/root,0x0all/ROOT,satyarth934/root,gbitzes/root,esakellari/my_root_for_test,mattkretz/root,sirinath/root,simonpf/root,karies/root,agarciamontoro/root,jrtomps/root,mattkretz/root,satyarth934/root,BerserkerTroll/root,davidlt/root,sawenzel/root,mkret2/root,dfunke/root,buuck/root,thomaskeck/root,thomaskeck/root,vukasinmilosevic/root,olifre/root,esakellari/my_root_for_test,olifre/root,cxx-hep/root-cern,Y--/root,gbitzes/root,esakellari/root,vukasinmilosevic/root,sbinet/cxx-root,mattkretz/root,evgeny-boger/root,vukasinmilosevic/root,mkret2/root,omazapa/root-old,beniz/root,sawenzel/root,omazapa/root,abhinavmoudgil95/root,BerserkerTroll/root,root-mirror/root,veprbl/root,pspe/root,veprbl/root,sbinet/cxx-root,nilqed/root,vukasinmilosevic/root,agarciamontoro/root,nilqed/root,omazapa/root,gganis/root,davidlt/root,pspe/root,olifre/root,omazapa/root,gganis/root,root-mirror/root,sawenzel/root,gbitzes/root,georgtroska/root,buuck/root,zzxuanyuan/root,thomaskeck/root,perovic/root,davidlt/root,nilqed/root,Y--/root,evgeny-boger/root,buuck/root,mhuwiler/rootauto,Duraznos/root,simonpf/root,smarinac/root,bbockelm/root,perovic/root,mhuwiler/rootauto,gganis/root,jrtomps/root,karies/root,davidlt/root,zzxuanyuan/root,zzxuanyuan/root-compressor-dummy,0x0all/ROOT,arch1tect0r/root,root-mirror/root,esakellari/my_root_for_test,arch1tect0r/root,olifre/root,sirinath/root,mattkretz/root,0x0all/ROOT,simonpf/root,karies/root,zzxuanyuan/root-compressor-dummy,alexschlueter/cern-root,omazapa/root,veprbl/root,BerserkerTroll/root,agarciamontoro/root,evgeny-boger/root,gganis/root,omazapa/root-old,root-mirror/root,root-mirror/root,gganis/root,beniz/root,zzxuanyuan/root,olifre/root,dfunke/root,gganis/root,veprbl/root,satyarth934/root,bbockelm/root,jrtomps/root,omazapa/root,simonpf/root