Ver código fonte

HPCC-14789 Ensure sizeof(target) is not incorrectly cached

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 9 anos atrás
pai
commit
e27122fd0c
1 arquivos alterados com 4 adições e 1 exclusões
  1. 4 1
      ecl/hqlcpp/hqlcppds.cpp

+ 4 - 1
ecl/hqlcpp/hqlcppds.cpp

@@ -4279,7 +4279,10 @@ void HqlCppTranslator::doBuildRowAssignAggregate(BuildCtx & ctx, IReferenceSelec
         guard.setown(ctx.getTempDeclare(boolType, queryBoolExpr(false)));
     }
 
-    doBuildRowAssignAggregateClear(ctx, target, expr);
+    //NB: The clear must occur inside a group, otherwise afterwards sizeof(target) will be bound to fixed values
+    BuildCtx clearctx(ctx);
+    clearctx.addGroup();
+    doBuildRowAssignAggregateClear(clearctx, target, expr);
     BuildCtx condctx(ctx);
     buildDatasetIterate(condctx, dataset, isSingleExists);
     doBuildRowAssignAggregateNext(condctx, target, expr, isSingleExists, guard);