فهرست منبع

Merge pull request #13225 from ghalliday/issue23223a

HPCC-23223 Protect statistic iterator from old workunits with null scopes

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 سال پیش
والد
کامیت
008fa67ef4
3فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 1 1
      common/workunit/workunit.cpp
  2. 1 0
      plugins/workunitservices/workunitservices.cpp
  3. 3 3
      system/jlib/jstats.cpp

+ 1 - 1
common/workunit/workunit.cpp

@@ -406,7 +406,7 @@ public:
     }
     virtual const char * queryScope() const
     {
-        return scope;
+        return scope ? scope : "";
     }
     virtual IStringVal & getFormattedValue(IStringVal & str) const
     {

+ 1 - 0
plugins/workunitservices/workunitservices.cpp

@@ -735,6 +735,7 @@ public:
         extra.getCreator(creator);
         StatisticScopeType scopeType = extra.getScopeType();
         const char * scope = extra.queryScope();
+        if (!scope) scope = "";
         extra.getDescription(description, true);
         StatisticMeasure measure = extra.getMeasure();
 

+ 3 - 3
system/jlib/jstats.cpp

@@ -122,16 +122,16 @@ MODULE_INIT(INIT_PRIORITY_STANDARD)
 
 extern jlib_decl int compareScopeName(const char * left, const char * right)
 {
-    if (!*left)
+    if (!left || !*left)
     {
-        if (!*right)
+        if (!right || !*right)
             return 0;
         else
             return -1;
     }
     else
     {
-        if (!*right)
+        if (!right || !*right)
             return +1;
     }