RDKEMW-1017 RDKEMW-1018: Miracast COMRPC with unittest updation#87
RDKEMW-1017 RDKEMW-1018: Miracast COMRPC with unittest updation#87yuvaramachandran-gurusamy wants to merge 37 commits intodevelopfrom
Conversation
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
…nto feature/RDKEMW-1017_1018_miracast_comrpc_support
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
…ssue Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
…ents API Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Coverity Issue - Variable copied when it could be moved"teardown_request" is passed-by-value as parameter to "std::__cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const &)", when it could be moved instead. Low Impact, CWE-none How to fixUse "std::move(""teardown_request"")" instead of "teardown_request". Issue locationThis issue was discovered outside the diff for this Pull Request. You can find it at: |
Coverity Issue - String not null terminatedPassing unterminated string "buffer" to "operator =", which expects a null-terminated string. [Note: The source code implementation of the function has been overridden by a builtin model.] High Impact, CWE-170 Issue locationThis issue was discovered outside the diff for this Pull Request. You can find it at: |
| } | ||
| else | ||
| { | ||
| returnPayload.message = "stopClientConnection received after Launch"; |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Logically dead code
Execution cannot reach this statement: "(returnPayload.message) = (...".
Medium Impact, CWE-561
DEADCODE
| LOGINFO("Call MiracastPlayerImplementation constructor"); | ||
| MiracastPlayerImplementation::_instance = this; | ||
| MIRACAST::logger_init("MiracastPlayer"); | ||
| } |
There was a problem hiding this comment.
Coverity Issue - Uninitialized pointer field
Non-static class member "_service" is not initialized in this constructor nor in any functions that it calls.
Medium Impact, CWE-457
UNINIT_CTOR
| } | ||
| else | ||
| { | ||
| setEnableInternal(false); |
There was a problem hiding this comment.
Coverity Issue - Waiting while holding a lock
Call to "setEnableInternal" might sleep while holding lock "lck._M_device".
Medium Impact, CWE-667
SLEEP
| } | ||
| else | ||
| { | ||
| setEnableInternal(false); |
There was a problem hiding this comment.
Coverity Issue - Waiting while holding a lock
Call to "setEnableInternal" might sleep while holding lock "lock._M_device".
Medium Impact, CWE-667
SLEEP
| receivedCSeqNum = parse_received_parser_field_value( temp_buffer , "CSeq: " ); | ||
| EXPECT_TRUE(temp_buffer.find("TEARDOWN") == 0); | ||
| trigger_response = "RTSP/1.0 200 OK\r\nCSeq: " + receivedCSeqNum + "\r\n\r\n"; | ||
| send_rtsp_msg(client_fd,trigger_response); |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Variable copied when it could be moved
"trigger_response" is passed-by-value as parameter to "std::__cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const &)", when it could be moved instead.
Low Impact, CWE-none
COPY_INSTEAD_OF_MOVE
How to fix
Use "std::move(""trigger_response"")" instead of "trigger_response".
| rtsp_hldr_msgq_data.state = RTSP_PAUSE_FROM_SINK2SRC; | ||
| Plugin::MiracastPlayerImplementation::_instance->m_miracast_rtsp_obj->send_msgto_rtsp_msg_hdler_thread(rtsp_hldr_msgq_data); | ||
| recv_rtsp_msg( client_fd , buffer , sizeof(buffer)); | ||
| temp_buffer = buffer; |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - String not null terminated
Passing unterminated string "buffer" to "operator =", which expects a null-terminated string. [Note: The source code implementation of the function has been overridden by a builtin model.]
High Impact, CWE-170
STRING_NULL
| rtsp_hldr_msgq_data.state = RTSP_PLAY_FROM_SINK2SRC; | ||
| Plugin::MiracastPlayerImplementation::_instance->m_miracast_rtsp_obj->send_msgto_rtsp_msg_hdler_thread(rtsp_hldr_msgq_data); | ||
| recv_rtsp_msg( client_fd , buffer , sizeof(buffer)); | ||
| temp_buffer = buffer; |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - String not null terminated
Passing unterminated string "buffer" to "operator =", which expects a null-terminated string. [Note: The source code implementation of the function has been overridden by a builtin model.]
High Impact, CWE-170
STRING_NULL
| rtsp_hldr_msgq_data.state = RTSP_TEARDOWN_FROM_SINK2SRC; | ||
| Plugin::MiracastPlayerImplementation::_instance->m_miracast_rtsp_obj->send_msgto_rtsp_msg_hdler_thread(rtsp_hldr_msgq_data); | ||
| recv_rtsp_msg( client_fd , buffer , sizeof(buffer)); | ||
| temp_buffer = buffer; |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - String not null terminated
Passing unterminated string "buffer" to "operator =", which expects a null-terminated string. [Note: The source code implementation of the function has been overridden by a builtin model.]
High Impact, CWE-170
STRING_NULL
|
|
||
| void InitializePowerManager(PluginHost::IShell *service); | ||
| void registerEventHandlers(); | ||
| const void InitializePowerState(); |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Parse warning
type qualifier on return type is meaningless
Low Impact, CWE-398
PW.USELESS_TYPE_QUALIFIER_ON_RETURN_TYPE
| if ( !is_connect_req_reported ) | ||
| { | ||
| changeServiceState(MIRACAST_SERVICE_STATE_DIRECT_LAUCH_REQUESTED); | ||
| m_src_dev_ip = src_dev_ip; |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Variable copied when it could be moved
"src_dev_ip" is copied in call to copy assignment for class "string", when it could be moved instead.
Low Impact, CWE-none
COPY_INSTEAD_OF_MOVE
How to fix
Use "std::move(""src_dev_ip"")" instead of "src_dev_ip".
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
| } | ||
| else | ||
| { | ||
| result.message = "stopClientConnection received after Launch"; |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Logically dead code
Execution cannot reach this statement: "(result.message) = ("stopCl...".
Medium Impact, CWE-561
DEADCODE
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
| { | ||
| usleep(500000); | ||
| TEST_LOG("Send Msg[%lu][%s]...",msg_buffer.size(),msg_buffer.c_str()); | ||
| send(sockfd, msg_buffer.c_str(), msg_buffer.size(), 0); |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Unchecked return value from library
Calling "send(sockfd, msg_buffer->c_str(), msg_buffer->size(), 0)" without checking return value. This library function may fail and return an error code.
Medium Impact, CWE-252
CHECKED_RETURN
| { | ||
| *bytes_processed_ptr = recv_return; | ||
| } | ||
| TEST_LOG("recv string [%s][%d] ...",buffer,recv_return); |
There was a problem hiding this comment.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Invalid type in argument to printf format specifier
Argument "buffer" to format specifier "%s" was expected to have type "char *" but has type "void *".
Medium Impact, CWE-686
PRINTF_ARGS
|
|
||
| if ( MIRACAST_SERVICE_STATE_PLAYER_LAUNCHED == current_state ) | ||
| { | ||
| result.message = "stopClientConnection received after Launch"; |
There was a problem hiding this comment.
Coverity Issue - Logically dead code
Execution cannot reach this statement: "(result.message) = ("stopCl...".
Medium Impact, CWE-561
DEADCODE
|
|
||
| if ( MIRACAST_SERVICE_STATE_PLAYER_LAUNCHED == current_state ) | ||
| { | ||
| result.message = "stopClientConnection received after Launch"; |
There was a problem hiding this comment.
Coverity Issue - Logically dead code
Execution cannot reach this statement: "(result.message) = ("stopCl...".
Medium Impact, CWE-561
DEADCODE
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
| void* buffer = nullptr; | ||
| GstBuffer *gstBuffer = nullptr; | ||
| self->m_pushBufferLoop = true; | ||
| while (self && (self->m_pushBufferLoop)) |
There was a problem hiding this comment.
Coverity Issue - Dereference before null check
Null-checking "self" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
Medium Impact, CWE-476
REVERSE_INULL
| MIRACASTLOG_ERROR("Failed to create MessageQueue"); | ||
| return false; | ||
| } | ||
| pthread_create(&m_playback_thread, nullptr, MiracastGstPlayer::playbackThread, this); |
There was a problem hiding this comment.
Coverity Issue - Unchecked return value
Calling "pthread_create" without checking return value (as is done elsewhere 2 out of 2 times).
Medium Impact, CWE-252
CHECKED_RETURN
| return false; | ||
| } | ||
| pthread_create(&m_playback_thread, nullptr, MiracastGstPlayer::playbackThread, this); | ||
| pthread_create(&m_pushbuffer_handler_tid, nullptr, MiracastGstPlayer::pushbuffer_handler_thread, this); |
There was a problem hiding this comment.
Coverity Issue - Unchecked return value
Calling "pthread_create" without checking return value (as is done elsewhere 2 out of 2 times).
Medium Impact, CWE-252
CHECKED_RETURN
| if (nullptr != buffer) | ||
| { | ||
| gstBuffer = static_cast<GstBuffer*>(buffer); | ||
| MIRACASTLOG_INFO("Received buffer [%x]", gstBuffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "gstBuffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
|
|
||
| if (nullptr != gstBuffer) | ||
| { | ||
| MIRACASTLOG_INFO("gstBuffer[%x]",gstBuffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "gstBuffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
| MIRACASTLOG_INFO("Received buffer [%x]", gstBuffer); | ||
| gst_buffer_unref(gstBuffer); | ||
| } | ||
| gstBuffer = NULL; |
There was a problem hiding this comment.
Coverity Issue - Unused value
Assigning value "NULL" to "gstBuffer" here, but that stored value is overwritten before it can be used.
Low Impact, CWE-563
UNUSED_VALUE
| self->m_customQueueHandle->sendData(static_cast<void*>(new_buffer)); | ||
| } | ||
| } | ||
| new_buffer = NULL; |
There was a problem hiding this comment.
Coverity Issue - Unused value
Assigning value "NULL" to "new_buffer" here, but that stored value is overwritten before it can be used.
Low Impact, CWE-563
UNUSED_VALUE
| new_buffer = gst_buffer_new_allocate(NULL, 128, NULL); | ||
| if (new_buffer) | ||
| { | ||
| MIRACASTLOG_INFO("gstBuffer[%x]",new_buffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "new_buffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
| void* buffer = nullptr; | ||
| GstBuffer *gstBuffer = nullptr; | ||
| self->m_pushBufferLoop = true; | ||
| while (self && (self->m_pushBufferLoop)) |
There was a problem hiding this comment.
Coverity Issue - Dereference before null check
Null-checking "self" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
Medium Impact, CWE-476
REVERSE_INULL
| MIRACASTLOG_ERROR("Failed to create MessageQueue"); | ||
| return false; | ||
| } | ||
| pthread_create(&m_playback_thread, nullptr, MiracastGstPlayer::playbackThread, this); |
There was a problem hiding this comment.
Coverity Issue - Unchecked return value
Calling "pthread_create" without checking return value (as is done elsewhere 2 out of 2 times).
Medium Impact, CWE-252
CHECKED_RETURN
| return false; | ||
| } | ||
| pthread_create(&m_playback_thread, nullptr, MiracastGstPlayer::playbackThread, this); | ||
| pthread_create(&m_pushbuffer_handler_tid, nullptr, MiracastGstPlayer::pushbuffer_handler_thread, this); |
There was a problem hiding this comment.
Coverity Issue - Unchecked return value
Calling "pthread_create" without checking return value (as is done elsewhere 2 out of 2 times).
Medium Impact, CWE-252
CHECKED_RETURN
| if (nullptr != buffer) | ||
| { | ||
| gstBuffer = static_cast<GstBuffer*>(buffer); | ||
| MIRACASTLOG_INFO("Received buffer [%x]", gstBuffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "gstBuffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
|
|
||
| if (nullptr != gstBuffer) | ||
| { | ||
| MIRACASTLOG_INFO("gstBuffer[%x]",gstBuffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "gstBuffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
| MIRACASTLOG_INFO("Received buffer [%x]", gstBuffer); | ||
| gst_buffer_unref(gstBuffer); | ||
| } | ||
| gstBuffer = NULL; |
There was a problem hiding this comment.
Coverity Issue - Unused value
Assigning value "NULL" to "gstBuffer" here, but that stored value is overwritten before it can be used.
Low Impact, CWE-563
UNUSED_VALUE
| self->m_customQueueHandle->sendData(static_cast<void*>(new_buffer)); | ||
| } | ||
| } | ||
| new_buffer = NULL; |
There was a problem hiding this comment.
Coverity Issue - Unused value
Assigning value "NULL" to "new_buffer" here, but that stored value is overwritten before it can be used.
Low Impact, CWE-563
UNUSED_VALUE
| new_buffer = gst_buffer_new_allocate(NULL, 128, NULL); | ||
| if (new_buffer) | ||
| { | ||
| MIRACASTLOG_INFO("gstBuffer[%x]",new_buffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "new_buffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
| void* buffer = nullptr; | ||
| GstBuffer *gstBuffer = nullptr; | ||
| self->m_pushBufferLoop = true; | ||
| while (self && (self->m_pushBufferLoop)) |
There was a problem hiding this comment.
Coverity Issue - Dereference before null check
Null-checking "self" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
Medium Impact, CWE-476
REVERSE_INULL
| MIRACASTLOG_ERROR("Failed to create MessageQueue"); | ||
| return false; | ||
| } | ||
| pthread_create(&m_playback_thread, nullptr, MiracastGstPlayer::playbackThread, this); |
There was a problem hiding this comment.
Coverity Issue - Unchecked return value
Calling "pthread_create" without checking return value (as is done elsewhere 2 out of 2 times).
Medium Impact, CWE-252
CHECKED_RETURN
| return false; | ||
| } | ||
| pthread_create(&m_playback_thread, nullptr, MiracastGstPlayer::playbackThread, this); | ||
| pthread_create(&m_pushbuffer_handler_tid, nullptr, MiracastGstPlayer::pushbuffer_handler_thread, this); |
There was a problem hiding this comment.
Coverity Issue - Unchecked return value
Calling "pthread_create" without checking return value (as is done elsewhere 2 out of 2 times).
Medium Impact, CWE-252
CHECKED_RETURN
| if (nullptr != buffer) | ||
| { | ||
| gstBuffer = static_cast<GstBuffer*>(buffer); | ||
| MIRACASTLOG_INFO("Received buffer [%x]", gstBuffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "gstBuffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
|
|
||
| if (nullptr != gstBuffer) | ||
| { | ||
| MIRACASTLOG_INFO("gstBuffer[%x]",gstBuffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "gstBuffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
| MIRACASTLOG_INFO("Received buffer [%x]", gstBuffer); | ||
| gst_buffer_unref(gstBuffer); | ||
| } | ||
| gstBuffer = NULL; |
There was a problem hiding this comment.
Coverity Issue - Unused value
Assigning value "NULL" to "gstBuffer" here, but that stored value is overwritten before it can be used.
Low Impact, CWE-563
UNUSED_VALUE
| self->m_customQueueHandle->sendData(static_cast<void*>(new_buffer)); | ||
| } | ||
| } | ||
| new_buffer = NULL; |
There was a problem hiding this comment.
Coverity Issue - Unused value
Assigning value "NULL" to "new_buffer" here, but that stored value is overwritten before it can be used.
Low Impact, CWE-563
UNUSED_VALUE
| new_buffer = gst_buffer_new_allocate(NULL, 128, NULL); | ||
| if (new_buffer) | ||
| { | ||
| MIRACASTLOG_INFO("gstBuffer[%x]",new_buffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "new_buffer" to format specifier "%x" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
Signed-off-by: yuvaramachandran_gurusamy <yuvaramachandran_gurusamy@comcast.com>
| if (nullptr != buffer) | ||
| { | ||
| gstBuffer = static_cast<GstBuffer*>(buffer); | ||
| MIRACASTLOG_INFO("Received buffer [%u]", gstBuffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "gstBuffer" to format specifier "%u" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
|
|
||
| if (nullptr != gstBuffer) | ||
| { | ||
| MIRACASTLOG_INFO("gstBuffer[%u]",gstBuffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "gstBuffer" to format specifier "%u" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
| new_buffer = gst_buffer_new_allocate(NULL, 128, NULL); | ||
| if (new_buffer) | ||
| { | ||
| MIRACASTLOG_INFO("gstBuffer[%u]",new_buffer); |
There was a problem hiding this comment.
Coverity Issue - Invalid type in argument to printf format specifier
Argument "new_buffer" to format specifier "%u" was expected to have type "unsigned int" but has type "GstBuffer *".
Medium Impact, CWE-686
PRINTF_ARGS
| } | ||
|
|
||
| public: | ||
| static Core::ProxyType<Core::IDispatch> Create(MiracastServiceImplementation *miracastServiceImplementation, Event event, JsonObject params) |
There was a problem hiding this comment.
Coverity Issue - Big parameter passed by value
Passing parameter params of type "JsonObject" (size 208 bytes) by value, which exceeds the low threshold of 128 bytes.
Low Impact, CWE-398
PASS_BY_VALUE
RDKEMW-1017 RDKEMW-1018: Miracast COMRPC with unittest updation
Signed-off-by: yuvaramachandran_gurusamy yuvaramachandran_gurusamy@comcast.com