Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/371#discussion_r55446152
  
    --- Diff: core/sql/exp/exp_datetime.cpp ---
    @@ -2337,6 +2430,50 @@ convertStrToMonth(char * value, char *result)
       return FALSE;
     }
     
    +static short convSrcDataToDst(Lng32 numSrcBytes, char* &srcData, 
    +                               Lng32 numTgtBytes, char *dstData,
    +                               const char * nextByte,
    +                               CollHeap * heap, ComDiagsArea** diagsArea)
    +{
    +  Lng32 src = 0;
    +  Lng32 val = 0;
    +  for (val = 0, src = 0; src < numSrcBytes && isDigit8859_1(*srcData); 
    +       src++, srcData++)
    +    val = val * 10 + (*srcData - '0');
    +  
    +  if (src < numSrcBytes) 
    +    {
    +      // string contains non-digit
    +      //
    +      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
    +      return -1;
    +    }
    +
    +  if (numTgtBytes == sizeof(Lng32))
    +    *(Lng32*)dstData = val;
    +  else if (numTgtBytes == sizeof(short))
    +    *(short*)dstData = val;
    +  else if (numTgtBytes == sizeof(char))
    +    *(char*)dstData = val;
    +  else 
    --- End diff --
    
    Do we know there won't be overflows on the assignments above? (Do we care?)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to