trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject incubator-trafodion git commit: Author: selvaganesang <selva.govindarajan@esgyn.com> Date: Sat Oct 28 04:27:49 2017 +0000
Date Mon, 30 Oct 2017 23:19:21 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 6e6d1ea41 -> 4ff25d987


Author: selvaganesang <selva.govindarajan@esgyn.com>
Date:   Sat Oct 28 04:27:49 2017 +0000

[TRAFODION-2785] mxosrvr dumps core generated when loading data from Oracle to Trafodion at
times

When there is an error while loading the data, the hexadecimal representation
of character column upto 254 bytes is shown as part of the error message.

The function stringToHex had a subtle bug that can cause buffer overrun resulting in stack
corruption.

This closes #1280


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/4ff25d98
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/4ff25d98
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/4ff25d98

Branch: refs/heads/master
Commit: 4ff25d987761958e2bd4f42ac997b876935bc9db
Parents: 6e6d1ea
Author: selvaganesang <selva@apache.org>
Authored: Mon Oct 30 23:14:08 2017 +0000
Committer: selvaganesang <selva@apache.org>
Committed: Mon Oct 30 23:15:26 2017 +0000

----------------------------------------------------------------------
 core/sql/exp/ExpError.cpp | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4ff25d98/core/sql/exp/ExpError.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpError.cpp b/core/sql/exp/ExpError.cpp
index 2105f2f..b9d03f5 100644
--- a/core/sql/exp/ExpError.cpp
+++ b/core/sql/exp/ExpError.cpp
@@ -608,17 +608,18 @@ ComDiagsArea *ExRaiseDetailSqlError(CollHeap* heap,
 
 char *stringToHex(char * out, Int32 outLen, char * in, Int32 inLen)
 {
-  //clear out buffer first
-  memset(out,0,outLen);
-
-  outLen = (outLen / 2) -1 ;
-
-  if(inLen < outLen) outLen = inLen;
 
+  Int32 hexLen = (outLen / 2) -1 ;
+  if (inLen < hexLen) 
+     hexLen = inLen;
+  if (hexLen < 0)
+     hexLen = 0;
+  if (outLen > 0)
+     out[0] = '\0';
   char hex[3];
-  for(int i = 0; i < outLen; i++)
+  for(int i = 0; i < hexLen; i++)
   {
-    sprintf(hex, "%02x", in[i]);
+    snprintf(hex, sizeof(hex), "%02x", (char)in[i]);
     strcat(out,hex);
   }
   return out;


Mime
View raw message