Преглед изворни кода

HPCC-19676 New Defects reported by Coverity Scan for HPCC-Platform 2018-05-14

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman пре 7 година
родитељ
комит
ffd16afd2a
3 измењених фајлова са 6 додато и 5 уклоњено
  1. 1 1
      rtl/eclrtl/rtldynfield.cpp
  2. 4 3
      rtl/eclrtl/rtlrecord.cpp
  3. 1 1
      rtl/eclrtl/rtlrecord.hpp

+ 1 - 1
rtl/eclrtl/rtldynfield.cpp

@@ -850,7 +850,7 @@ private:
                     init = malloc(initLength);
                     init = malloc(initLength);
                     memcpy(init, type.readDirect(initLength), initLength);
                     memcpy(init, type.readDirect(initLength), initLength);
                 }
                 }
-                if (fieldFlags & RFTMhasVirtualInitializer)
+                else if (fieldFlags & RFTMhasVirtualInitializer)
                 {
                 {
                     byte virtualKind;
                     byte virtualKind;
                     type.read(virtualKind);
                     type.read(virtualKind);

+ 4 - 3
rtl/eclrtl/rtlrecord.cpp

@@ -633,8 +633,10 @@ RtlRow::RtlRow(const RtlRecord & _info, const void * optRow, unsigned numOffsets
 
 
 size_t RtlRow::noVariableOffsets [1] = {0};
 size_t RtlRow::noVariableOffsets [1] = {0};
 
 
-RtlRow::RtlRow(const RtlRecord & _info) : info(_info), variableOffsets(noVariableOffsets)
+RtlRow::RtlRow(const RtlRecord & _info, const void *_row) : info(_info), variableOffsets(noVariableOffsets)
 {
 {
+    row = (const byte *)_row;
+
 }
 }
 
 
 __int64 RtlRow::getInt(unsigned field) const
 __int64 RtlRow::getInt(unsigned field) const
@@ -737,9 +739,8 @@ void RtlRow::lazyCalcOffsets(unsigned _numFieldsUsed) const
 }
 }
 
 
 RtlFixedRow::RtlFixedRow(const RtlRecord & _info, const void *_row, unsigned _numFieldsUsed)
 RtlFixedRow::RtlFixedRow(const RtlRecord & _info, const void *_row, unsigned _numFieldsUsed)
-: RtlRow(_info)
+: RtlRow(_info, _row)
 {
 {
-    row = (const byte *) _row;
     numFieldsUsed = _numFieldsUsed;
     numFieldsUsed = _numFieldsUsed;
     dbgassertex(info.isFixedOffset(numFieldsUsed));
     dbgassertex(info.isFixedOffset(numFieldsUsed));
 }
 }

+ 1 - 1
rtl/eclrtl/rtlrecord.hpp

@@ -294,7 +294,7 @@ public:
     }
     }
     explicit operator bool() { return row != nullptr; }
     explicit operator bool() { return row != nullptr; }
 protected:
 protected:
-    RtlRow(const RtlRecord & _info);  // for use by fixed-only case
+    RtlRow(const RtlRecord & _info, const void *_row);  // for use by fixed-only case
 
 
     const RtlRecord & info;
     const RtlRecord & info;
     const byte * row;
     const byte * row;