Fix clr!Thread::GetStaticFieldAddrNoCreate() to avoid returning data offset (0x4) instead of NULL for thread static fields when fields are a structure. The issue appears only when clr!MethodTable::GetGCThreadStaticsBasePointer() returns the pointer to the element of static object array and the element is zero. This bug was detected in desktop CLR v4.6.00079 x86/x64, but also present in CoreCLR.
Fix clr!Thread::GetStaticFieldAddrNoCreate() to avoid returning data offset (0x4) instead of NULL for thread static fields when fields are a structure. The issue appears only when clr!MethodTable::GetGCThreadStaticsBasePointer() returns the pointer to the element of static object array and the element is zero. This bug was detected in desktop CLR v4.6.00079 x86/x64, but also present in CoreCLR.

struct DataCollector
{
  [ThreadStatic]
  static DataCollector ThreadInstance;
  ...
}

P.S. Detailed information about this issue is in JetBrains issue tracker: https://youtrack.jetbrains.com/issue/DMRY-2965

tijoytom/coreclr,ramarag/coreclr,sejongoh/coreclr,cydhaselton/coreclr,dpodder/coreclr,sagood/coreclr,JonHanna/coreclr,krytarowski/coreclr,mskvortsov/coreclr,mmitche/coreclr,krk/coreclr,ruben-ayrapetyan/coreclr,cmckinsey/coreclr,mokchhya/coreclr,Lucrecious/coreclr,mskvortsov/coreclr,gkhanna79/coreclr,naamunds/coreclr,parjong/coreclr,parjong/coreclr,wtgodbe/coreclr,tijoytom/coreclr,manu-silicon/coreclr,cshung/coreclr,swgillespie/coreclr,roncain/coreclr,James-Ko/coreclr,gkhanna79/coreclr,josteink/coreclr,vinnyrom/coreclr,mocsy/coreclr,sperling/coreclr,alexperovich/coreclr,martinwoodward/coreclr,hseok-oh/coreclr,LLITCHEV/coreclr,russellhadley/coreclr,James-Ko/coreclr,JonHanna/coreclr,JonHanna/coreclr,AlexGhiondea/coreclr,pgavlin/coreclr,cshung/coreclr,josteink/coreclr,botaberg/coreclr,cshung/coreclr,schellap/coreclr,shahid-pk/coreclr,ragmani/coreclr,Dmitry-Me/coreclr,dasMulli/coreclr,josteink/coreclr,krk/coreclr,neurospeech/coreclr,chuck-mitchell/coreclr,sejongoh/coreclr,bartdesmet/coreclr,mmitche/coreclr,ZhichengZhu/coreclr,Godin/coreclr,YongseopKim/coreclr,James-Ko/coreclr,sagood/coreclr,jhendrixMSFT/coreclr,parjong/coreclr,martinwoodward/coreclr,mocsy/coreclr,SlavaRa/coreclr,wkchoy74/coreclr,shahid-pk/coreclr,benpye/coreclr,ramarag/coreclr,cmckinsey/coreclr,Dmitry-Me/coreclr,krytarowski/coreclr,benpye/coreclr,parjong/coreclr,Godin/coreclr,hseok-oh/coreclr,Lucrecious/coreclr,YongseopKim/coreclr,tijoytom/coreclr,wkchoy74/coreclr,schellap/coreclr,krytarowski/coreclr,sejongoh/coreclr,bartdesmet/coreclr,naamunds/coreclr,wtgodbe/coreclr,manu-silicon/coreclr,krytarowski/coreclr,neurospeech/coreclr,wateret/coreclr,rartemev/coreclr,James-Ko/coreclr,dasMulli/coreclr,KrzysztofCwalina/coreclr,pgavlin/coreclr,yizhang82/coreclr,roncain/coreclr,Dmitry-Me/coreclr,KrzysztofCwalina/coreclr,krytarowski/coreclr,schellap/coreclr,bartonjs/coreclr,naamunds/coreclr,russellhadley/coreclr,mskvortsov/coreclr,ruben-ayrapetyan/coreclr,krk/coreclr,dasMulli/coreclr,wkchoy74/coreclr,sejongoh/coreclr,poizan42/coreclr,pgavlin/coreclr,YongseopKim/coreclr,sperling/coreclr,yeaicc/coreclr,cydhaselton/coreclr,kyulee1/coreclr,martinwoodward/coreclr,vinnyrom/coreclr,Godin/coreclr,ragmani/coreclr,dpodder/coreclr,schellap/coreclr,SlavaRa/coreclr,ragmani/coreclr,botaberg/coreclr,botaberg/coreclr,Godin/coreclr,ZhichengZhu/coreclr,naamunds/coreclr,jhendrixMSFT/coreclr,yizhang82/coreclr,andschwa/coreclr,ramarag/coreclr,swgillespie/coreclr,sperling/coreclr,JosephTremoulet/coreclr,yeaicc/coreclr,jamesqo/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,sjsinju/coreclr,mocsy/coreclr,yeaicc/coreclr,bartdesmet/coreclr,sagood/coreclr,mocsy/coreclr,sjsinju/coreclr,dpodder/coreclr,dpodder/coreclr,sjsinju/coreclr,tijoytom/coreclr,Dmitry-Me/coreclr,dasMulli/coreclr,LLITCHEV/coreclr,ramarag/coreclr,qiudesong/coreclr,kyulee1/coreclr,russellhadley/coreclr,AlexGhiondea/coreclr,benpye/coreclr,mskvortsov/coreclr,botaberg/coreclr,ruben-ayrapetyan/coreclr,sjsinju/coreclr,alexperovich/coreclr,chuck-mitchell/coreclr,swgillespie/coreclr,shahid-pk/coreclr,jamesqo/coreclr,rartemev/coreclr,mmitche/coreclr,KrzysztofCwalina/coreclr,ruben-ayrapetyan/coreclr,alexperovich/coreclr,rartemev/coreclr,pgavlin/coreclr,ruben-ayrapetyan/coreclr,hseok-oh/coreclr,bartdesmet/coreclr,sperling/coreclr,YongseopKim/coreclr,yeaicc/coreclr,wtgodbe/coreclr,yizhang82/coreclr,bartonjs/coreclr,jhendrixMSFT/coreclr,krk/coreclr,bartonjs/coreclr,shahid-pk/coreclr,swgillespie/coreclr,manu-silicon/coreclr,gkhanna79/coreclr,yizhang82/coreclr,martinwoodward/coreclr,LLITCHEV/coreclr,sperling/coreclr,LLITCHEV/coreclr,russellhadley/coreclr,mskvortsov/coreclr,jamesqo/coreclr,jamesqo/coreclr,dpodder/coreclr,Dmitry-Me/coreclr,poizan42/coreclr,Lucrecious/coreclr,swgillespie/coreclr,cydhaselton/coreclr,neurospeech/coreclr,SlavaRa/coreclr,qiudesong/coreclr,chuck-mitchell/coreclr,jamesqo/coreclr,stormleoxia/coreclr,rartemev/coreclr,andschwa/coreclr,YongseopKim/coreclr,JosephTremoulet/coreclr,mocsy/coreclr,cmckinsey/coreclr,poizan42/coreclr,neurospeech/coreclr,benpye/coreclr,poizan42/coreclr,benpye/coreclr,James-Ko/coreclr,wateret/coreclr,stormleoxia/coreclr,SlavaRa/coreclr,sjsinju/coreclr,poizan42/coreclr,kyulee1/coreclr,krk/coreclr,jhendrixMSFT/coreclr,Godin/coreclr,dasMulli/coreclr,sjsinju/coreclr,wateret/coreclr,ZhichengZhu/coreclr,AlexGhiondea/coreclr,yizhang82/coreclr,dasMulli/coreclr,benpye/coreclr,vinnyrom/coreclr,alexperovich/coreclr,mmitche/coreclr,bartdesmet/coreclr,mmitche/coreclr,russellhadley/coreclr,cmckinsey/coreclr,wateret/coreclr,stormleoxia/coreclr,Lucrecious/coreclr,ruben-ayrapetyan/coreclr,josteink/coreclr,Lucrecious/coreclr,Godin/coreclr,sejongoh/coreclr,yeaicc/coreclr,yizhang82/coreclr,bartdesmet/coreclr,wkchoy74/coreclr,botaberg/coreclr,hseok-oh/coreclr,andschwa/coreclr,andschwa/coreclr,JonHanna/coreclr,kyulee1/coreclr,tijoytom/coreclr,SlavaRa/coreclr,ZhichengZhu/coreclr,sperling/coreclr,andschwa/coreclr,swgillespie/coreclr,jhendrixMSFT/coreclr,wkchoy74/coreclr,wtgodbe/coreclr,qiudesong/coreclr,rartemev/coreclr,vinnyrom/coreclr,jhendrixMSFT/coreclr,JonHanna/coreclr,gkhanna79/coreclr,SlavaRa/coreclr,russellhadley/coreclr,Lucrecious/coreclr,AlexGhiondea/coreclr,josteink/coreclr,mokchhya/coreclr,qiudesong/coreclr,cshung/coreclr,stormleoxia/coreclr,vinnyrom/coreclr,martinwoodward/coreclr,AlexGhiondea/coreclr,chuck-mitchell/coreclr,mskvortsov/coreclr,Dmitry-Me/coreclr,kyulee1/coreclr,cmckinsey/coreclr,LLITCHEV/coreclr,ragmani/coreclr,LLITCHEV/coreclr,shahid-pk/coreclr,rartemev/coreclr,wkchoy74/coreclr,josteink/coreclr,naamunds/coreclr,ZhichengZhu/coreclr,parjong/coreclr,ZhichengZhu/coreclr,sagood/coreclr,tijoytom/coreclr,kyulee1/coreclr,poizan42/coreclr,manu-silicon/coreclr,schellap/coreclr,AlexGhiondea/coreclr,ragmani/coreclr,mokchhya/coreclr,pgavlin/coreclr,naamunds/coreclr,mokchhya/coreclr,roncain/coreclr,roncain/coreclr,hseok-oh/coreclr,JosephTremoulet/coreclr,alexperovich/coreclr,krk/coreclr,andschwa/coreclr,ramarag/coreclr,manu-silicon/coreclr,sagood/coreclr,KrzysztofCwalina/coreclr,vinnyrom/coreclr,bartonjs/coreclr,schellap/coreclr,JosephTremoulet/coreclr,dasMulli/coreclr,benpye/coreclr,cmckinsey/coreclr,manu-silicon/coreclr,manu-silicon/coreclr,neurospeech/coreclr,schellap/coreclr,JosephTremoulet/coreclr,hseok-oh/coreclr,roncain/coreclr,YongseopKim/coreclr,shahid-pk/coreclr,ramarag/coreclr,ramarag/coreclr,KrzysztofCwalina/coreclr,mocsy/coreclr,mokchhya/coreclr,KrzysztofCwalina/coreclr,alexperovich/coreclr,wateret/coreclr,sejongoh/coreclr,jhendrixMSFT/coreclr,cshung/coreclr,bartdesmet/coreclr,chuck-mitchell/coreclr,pgavlin/coreclr,stormleoxia/coreclr,krytarowski/coreclr,ragmani/coreclr,sejongoh/coreclr,sagood/coreclr,cshung/coreclr,KrzysztofCwalina/coreclr,JosephTremoulet/coreclr,jamesqo/coreclr,botaberg/coreclr,mokchhya/coreclr,andschwa/coreclr,neurospeech/coreclr,sperling/coreclr,bartonjs/coreclr,josteink/coreclr,parjong/coreclr,Lucrecious/coreclr,cydhaselton/coreclr,Dmitry-Me/coreclr,yeaicc/coreclr,gkhanna79/coreclr,qiudesong/coreclr,martinwoodward/coreclr,roncain/coreclr,stormleoxia/coreclr,cydhaselton/coreclr,ZhichengZhu/coreclr,cydhaselton/coreclr,shahid-pk/coreclr,bartonjs/coreclr,roncain/coreclr,wkchoy74/coreclr,yeaicc/coreclr,chuck-mitchell/coreclr,chuck-mitchell/coreclr,swgillespie/coreclr,vinnyrom/coreclr,martinwoodward/coreclr,bartonjs/coreclr,James-Ko/coreclr,mmitche/coreclr,cmckinsey/coreclr,naamunds/coreclr,LLITCHEV/coreclr,gkhanna79/coreclr,JonHanna/coreclr,wateret/coreclr,qiudesong/coreclr,mokchhya/coreclr,Godin/coreclr,dpodder/coreclr,mocsy/coreclr,stormleoxia/coreclr