Explorar o código

HPCC-20038 Fix potential core processing multi part keyed join in hthor

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday %!s(int64=6) %!d(string=hai) anos
pai
achega
525f0493e5
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      ecl/hthor/hthorkey.cpp

+ 4 - 0
ecl/hthor/hthorkey.cpp

@@ -2873,6 +2873,7 @@ public:
     ~CJoinGroup()
     {
         ReleaseRoxieRow(left);
+        join = nullptr; // not required, but clear to highlight any race conditions
     }
 
     MatchSet * getMatchSet()
@@ -2902,6 +2903,9 @@ public:
     inline void noteEnd()
     {
         assertex(!complete());
+        //Another completing group could cause this group to be processed once endMarkersPending is set to 0
+        //So link this object to ensure it is not disposed of while this function is executing
+        Linked<CJoinGroup> saveThis(this);
         if (atomic_dec_and_test(&groupStart->endMarkersPending))
         {
             join->onComplete(groupStart);