[ 
https://issues.apache.org/jira/browse/TRAFODION-3039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16450033#comment-16450033
 ] 

ASF GitHub Bot commented on TRAFODION-3039:
-------------------------------------------

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

    https://github.com/apache/trafodion/pull/1534#discussion_r183770455
  
    --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
    @@ -6533,6 +6533,8 @@ odbc_SQLSrvr_ExtractLob_sme_(
             if (retcode == SQL_ERROR)
             {
                 ERROR_DESC_def *p_buffer = 
QryLobExtractSrvrStmt->sqlError.errorList._buffer;
    +            char             errNumStr[128];
    +            sprintf(errNumStr, "%d", p_buffer->sqlcode);
                 strncpy(RequestError, p_buffer->errorText, 
sizeof(RequestError) - 1);
    --- End diff --
    
    Surround code issue.  RequestError may not be null terminated when the 
RequestError size is less than the length of the string in p_buffer->errorText. 
Also, this can cause core dump due to segment violation if length of errorText 
is less than the size of RequestBuffer. 


> SendEventMsg is used in a wrong way
> -----------------------------------
>
>                 Key: TRAFODION-3039
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-3039
>             Project: Apache Trafodion
>          Issue Type: Bug
>            Reporter: xiaozhong.wang
>            Priority: Major
>
> I find a lot of place used SendEventMsg in a wrong way.
> void ODBCMXEventMsg::SendEventMsg(
> DWORD EventId, 
> short EventLogType, 
> DWORD Pid, 
> char *ComponentName,
> char *ObjectRef, 
> short nToken, ...)
> the parameter which is after nToken must be string
> but there are a lot places used number.
> 5158 SendEventMsg(MSG_SQL_ERROR,
> 5159 EVENTLOG_ERROR_TYPE,
> 5160 srvrGlobal->nskProcessInfo.processId,
> 5161 ODBCMX_SERVER,
> 5162 srvrGlobal->srvrObjRef,
> 5163 2,
> {color:#d04437}5164 p_buffer->sqlcode,{color}
> 5165 RequestError);
> This make a core when a error happened, the stack is as following:
> #1 0x00007f7aa18dfbfd in abort () from /lib64/libc.so.6
> #2 0x00007f7aa30c4d95 in ?? ()
>  from 
> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64/jre/lib/amd64/server/libjvm.so
> #3 0x00007f7aa32575b3 in ?? ()
>  from 
> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64/jre/lib/amd64/server/libjvm.so
> #4 0x00007f7aa30caef2 in JVM_handle_linux_signal ()
>  from 
> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64/jre/lib/amd64/server/libjvm.so
> #5 0x00007f7aa30c0753 in ?? ()
>  from 
> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64/jre/lib/amd64/server/libjvm.so
> #6 <signal handler called>
> #7 0x00007f7aa19df94f in __strlen_sse42 () from /lib64/libc.so.6
> #8 0x00007f7aa2178b1c in std::string::replace(unsigned long, unsigned long, 
> char const*) ()
>  from /usr/lib64/libstdc++.so.6
> #9 0x00000000005cfe6c in send_to_eventlog (evt_num=20004, EventLogType=1,
>  ComponentName=0x7f7aa40c4489 "ODBC/MX Server", ObjectRef=0x3064e08 "", 
> nToken=2, marker=0x7f7a8d1294a0)
>  at ../Common/PubInterface.cpp:137
> #10 0x00000000005d0011 in SendEventMsg (EventId=3221311012, EventLogType=1, 
> Pid=20278,
>  ComponentName=0x7f7aa40c4489 "ODBC/MX Server", ObjectRef=0x3064e08 "", 
> nToken=2) at ../Common/PubInterface.cpp:167
> #11 0x00007f7aa4080b03 in odbc_SQLSvc_GetSQLCatalogs_sme_ (objtag_=0x546e300, 
> call_id_=0x546e358,
>  exception_=0x7f7a8d131c60, dialogueId=511906771, stmtLabel=0x5a57c48 
> "STMT_CA_535940037", APIType=53,
>  catalogNm=0x5a57c60 "TRAFODION", schemaNm=0x5a57c6e "_LIBMGR_", 
> tableNm=0x5a57c7b "%", tableTypeList=0x5a57c81 "",
>  columnNm=0x5a57c86 "%", columnType=0, rowIdScope=0, nullable=0, 
> uniqueness=1, accuracy=0, sqlType=0, metadataId=0,
>  fkcatalogNm=0x5a57ca5 "", fkschemaNm=0x5a57caa "", fktableNm=0x5a57caf "",
>  catStmtLabel=0x7f7a8d131a50 "STMT_CA_535940037", outputDesc=0x7f7a8d131cc0, 
> sqlWarning=0x7f7a8d131ca0)
>  at srvrothers.cpp:5165
> #12 0x0000000000570580 in odbc_SQLSrvr_GetSQLCatalogs_ame_ 
> (objtag_=0x546e300, call_id_=0x546e358,
>  dialogueId=511906771, stmtLabel=0x5a57c48 "STMT_CA_535940037", APIType=53, 
> catalogNm=0x5a57c60 "TRAFODION",
>  schemaNm=0x5a57c6e "_LIBMGR_", tableNm=0x5a57c7b "%", 
> tableTypeList=0x5a57c81 "", columnNm=0x5a57c86 "%",
>  columnType=0, rowIdScope=0, nullable=0, uniqueness=1, accuracy=0, sqlType=0, 
> metadataId=0,
>  fkcatalogNm=0x5a57ca5 "", fkschemaNm=0x5a57caa "", fktableNm=0x5a57caf "") 
> at SrvrSMD.cpp:204
> #13 0x0000000000529f55 in SQLGETCATALOGS_IOMessage (objtag_=0x546e300, 
> call_id_=0x546e358)
>  at Interface/odbcs_srvr.cpp:1246
> #14 0x000000000052b3c3 in DISPATCH_TCPIPRequest (objtag_=0x546e300, 
> call_id_=0x546e358, operation_id=3016)
>  at Interface/odbcs_srvr.cpp:1912
> #15 0x000000000046a25c in BUILD_TCPIP_REQUEST (pnode=0x546e300) at 
> ../Common/TCPIPSystemSrvr.cpp:607
> #16 0x000000000046a1a3 in PROCESS_TCPIP_REQUEST (pnode=0x546e300) at 
> ../Common/TCPIPSystemSrvr.cpp:585
> #17 0x00000000004b99a4 in CNSKListenerSrvr::CheckTCPIPRequest 
> (this=0x2f35140, ipnode=0x546e300)
>  at Interface/Listener_srvr.cpp:64
> #18 0x00000000004cbd03 in CNSKListenerSrvr::tcpip_listener (arg=0x2f35140) at 
> Interface/linux/Listener_srvr_ps.cpp:551
> #19 0x00007f7aa16911ce in sb_thread_sthr_disp (pp_arg=0x30649d0) at 
> threadl.cpp:270
> #20 0x00007f7aa4766aa1 in start_thread () from /lib64/libpthread.so.0
> #21 0x00007f7aa1994bcd in clone () from /lib64/libc.so.6
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to