From 5a2dc641fe23f1a56bc34eddada9b6293c8a73ca Mon Sep 17 00:00:00 2001 From: dkumar798_comcast Date: Wed, 3 Dec 2025 09:20:02 +0000 Subject: [PATCH 1/6] RDKEMW-11021: fix the copilot static code analysis issues in hdmicec --- ccec/src/Bus.cpp | 9 ++++++++- ccec/src/DriverImpl.cpp | 9 ++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ccec/src/Bus.cpp b/ccec/src/Bus.cpp index a92efac..8994812 100644 --- a/ccec/src/Bus.cpp +++ b/ccec/src/Bus.cpp @@ -390,8 +390,15 @@ void Bus::sendAsync(const CECFrame &frame) CECFrame *copyFrame = (new CECFrame()); *copyFrame = frame; + // Copilot fix: Add exception-safe cleanup to prevent memory leak if offer() throws + try { + wQueue.offer((copyFrame)); + } + catch (...) { + delete copyFrame; + throw; + } - wQueue.offer((copyFrame)); } } diff --git a/ccec/src/DriverImpl.cpp b/ccec/src/DriverImpl.cpp index 31e1de9..0dde6e2 100644 --- a/ccec/src/DriverImpl.cpp +++ b/ccec/src/DriverImpl.cpp @@ -70,7 +70,9 @@ void DriverImpl::DriverReceiveCallback(int handle, void *callbackData, unsigned static_cast(Driver::getInstance()).getIncomingQueue(handle).offer(frame); } catch(...) { - CCEC_LOG( LOG_EXP, "Exception during frame offer...discarding\r\n"); + CCEC_LOG( LOG_EXP, "Exception during frame offer...discarding\r\n"); + // Copilot fix: Delete frame to prevent memory leak when offer() throws exception + delete frame; } CCEC_LOG( LOG_DEBUG, "frame offered\r\n"); } @@ -270,11 +272,12 @@ void DriverImpl::write(const CECFrame &frame) noexcept(false) } } - if (((frame.at(0) & 0x0F) != 0x0F) && sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD) { + // Copilot fix: Add bounds checking before frame.at() to prevent buffer overflow + if ((length > 0) && ((frame.at(0) & 0x0F) != 0x0F) && sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD) { throw CECNoAckException(); } /* CEC CTS 9-3-3 -Ensure that the DUT will accept a negatively for broadcat report physical address msg and retry atleast once */ - else if (((frame.at(0) & 0x0F) == 0x0F) && (length > 1) && ((frame.at(1) & 0xFF) == REPORT_PHYSICAL_ADDRESS ) && (sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD)) + else if ((length > 1) && ((frame.at(0) & 0x0F) == 0x0F) && ((frame.at(1) & 0xFF) == REPORT_PHYSICAL_ADDRESS ) && (sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD)) { throw CECNoAckException(); From 3a6a3cb65df1d6a552ef01fbeaad956d40b8014c Mon Sep 17 00:00:00 2001 From: dkumar798_comcast Date: Wed, 3 Dec 2025 09:26:06 +0000 Subject: [PATCH 2/6] RDKEMW-11021: fix the copilot static code analysis issues in hdmicec --- ccec/src/Bus.cpp | 2 +- ccec/src/DriverImpl.cpp | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ccec/src/Bus.cpp b/ccec/src/Bus.cpp index 8994812..f2c47bf 100644 --- a/ccec/src/Bus.cpp +++ b/ccec/src/Bus.cpp @@ -392,7 +392,7 @@ void Bus::sendAsync(const CECFrame &frame) *copyFrame = frame; // Copilot fix: Add exception-safe cleanup to prevent memory leak if offer() throws try { - wQueue.offer((copyFrame)); + wQueue.offer((copyFrame)); } catch (...) { delete copyFrame; diff --git a/ccec/src/DriverImpl.cpp b/ccec/src/DriverImpl.cpp index 0dde6e2..35c03bf 100644 --- a/ccec/src/DriverImpl.cpp +++ b/ccec/src/DriverImpl.cpp @@ -274,14 +274,13 @@ void DriverImpl::write(const CECFrame &frame) noexcept(false) // Copilot fix: Add bounds checking before frame.at() to prevent buffer overflow if ((length > 0) && ((frame.at(0) & 0x0F) != 0x0F) && sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD) { - throw CECNoAckException(); - } - /* CEC CTS 9-3-3 -Ensure that the DUT will accept a negatively for broadcat report physical address msg and retry atleast once */ - else if ((length > 1) && ((frame.at(0) & 0x0F) == 0x0F) && ((frame.at(1) & 0xFF) == REPORT_PHYSICAL_ADDRESS ) && (sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD)) - { - - throw CECNoAckException(); + throw CECNoAckException(); } + /* CEC CTS 9-3-3 -Ensure that the DUT will accept a negatively for broadcat report physical address msg and retry atleast once */ + else if ((length > 1) && ((frame.at(0) & 0x0F) == 0x0F) && ((frame.at(1) & 0xFF) == REPORT_PHYSICAL_ADDRESS ) && (sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD)) + { + throw CECNoAckException(); + } } CCEC_LOG( LOG_DEBUG, "Send Completed\r\n"); From ce3b579514709c3953974429683988e1f610e92f Mon Sep 17 00:00:00 2001 From: dkumar798_comcast Date: Wed, 3 Dec 2025 09:35:08 +0000 Subject: [PATCH 3/6] RDKEMW-11021: fix the copilot static code analysis issues in hdmicec --- ccec/src/Bus.cpp | 26 +++++++++++++------------- ccec/src/DriverImpl.cpp | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ccec/src/Bus.cpp b/ccec/src/Bus.cpp index f2c47bf..263476d 100644 --- a/ccec/src/Bus.cpp +++ b/ccec/src/Bus.cpp @@ -384,22 +384,22 @@ void Bus::send(const CECFrame &frame, int timeout) */ void Bus::sendAsync(const CECFrame &frame) { - {AutoLock lock_(wMutex); + {AutoLock lock_(wMutex); - if (!started) throw InvalidStateException(); + if (!started) throw InvalidStateException(); - CECFrame *copyFrame = (new CECFrame()); - *copyFrame = frame; - // Copilot fix: Add exception-safe cleanup to prevent memory leak if offer() throws - try { - wQueue.offer((copyFrame)); - } - catch (...) { - delete copyFrame; - throw; - } + CECFrame *copyFrame = (new CECFrame()); + *copyFrame = frame; + // Copilot fix: Add exception-safe cleanup to prevent memory leak if offer() throws + try { + wQueue.offer((copyFrame)); + } + catch (...) { + delete copyFrame; + throw; + } - } + } } /** diff --git a/ccec/src/DriverImpl.cpp b/ccec/src/DriverImpl.cpp index 35c03bf..0647895 100644 --- a/ccec/src/DriverImpl.cpp +++ b/ccec/src/DriverImpl.cpp @@ -275,7 +275,7 @@ void DriverImpl::write(const CECFrame &frame) noexcept(false) // Copilot fix: Add bounds checking before frame.at() to prevent buffer overflow if ((length > 0) && ((frame.at(0) & 0x0F) != 0x0F) && sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD) { throw CECNoAckException(); - } + } /* CEC CTS 9-3-3 -Ensure that the DUT will accept a negatively for broadcat report physical address msg and retry atleast once */ else if ((length > 1) && ((frame.at(0) & 0x0F) == 0x0F) && ((frame.at(1) & 0xFF) == REPORT_PHYSICAL_ADDRESS ) && (sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD)) { From ec8b0abab732efa09add528d669e04f26c1f5367 Mon Sep 17 00:00:00 2001 From: dkumar798_comcast Date: Wed, 3 Dec 2025 09:59:59 +0000 Subject: [PATCH 4/6] RDKEMW-11021: fix the copilot static code analysis issues in hdmicec --- ccec/src/DriverImpl.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ccec/src/DriverImpl.cpp b/ccec/src/DriverImpl.cpp index 0647895..13b90f4 100644 --- a/ccec/src/DriverImpl.cpp +++ b/ccec/src/DriverImpl.cpp @@ -70,9 +70,9 @@ void DriverImpl::DriverReceiveCallback(int handle, void *callbackData, unsigned static_cast(Driver::getInstance()).getIncomingQueue(handle).offer(frame); } catch(...) { - CCEC_LOG( LOG_EXP, "Exception during frame offer...discarding\r\n"); - // Copilot fix: Delete frame to prevent memory leak when offer() throws exception - delete frame; + CCEC_LOG( LOG_EXP, "Exception during frame offer...discarding\r\n"); + // Copilot fix: Delete frame to prevent memory leak when offer() throws exception + delete frame; } CCEC_LOG( LOG_DEBUG, "frame offered\r\n"); } @@ -272,15 +272,15 @@ void DriverImpl::write(const CECFrame &frame) noexcept(false) } } - // Copilot fix: Add bounds checking before frame.at() to prevent buffer overflow - if ((length > 0) && ((frame.at(0) & 0x0F) != 0x0F) && sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD) { - throw CECNoAckException(); - } - /* CEC CTS 9-3-3 -Ensure that the DUT will accept a negatively for broadcat report physical address msg and retry atleast once */ - else if ((length > 1) && ((frame.at(0) & 0x0F) == 0x0F) && ((frame.at(1) & 0xFF) == REPORT_PHYSICAL_ADDRESS ) && (sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD)) - { - throw CECNoAckException(); - } + if (((frame.at(0) & 0x0F) != 0x0F) && sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD) { + throw CECNoAckException(); + } + /* CEC CTS 9-3-3 -Ensure that the DUT will accept a negatively for broadcat report physical address msg and retry atleast once */ + else if (((frame.at(0) & 0x0F) == 0x0F) && (length > 1) && ((frame.at(1) & 0xFF) == REPORT_PHYSICAL_ADDRESS ) && (sendResult == HDMI_CEC_IO_SENT_BUT_NOT_ACKD)) + { + + throw CECNoAckException(); + } } CCEC_LOG( LOG_DEBUG, "Send Completed\r\n"); From 48818da500cc9b66b27bdfae557975499ab2e9ac Mon Sep 17 00:00:00 2001 From: dkumar798_comcast Date: Wed, 3 Dec 2025 11:06:42 +0000 Subject: [PATCH 5/6] RDKEMW-11021: fix the copilot static code analysis issues in hdmicec --- ccec/src/Bus.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ccec/src/Bus.cpp b/ccec/src/Bus.cpp index 263476d..adc4af0 100644 --- a/ccec/src/Bus.cpp +++ b/ccec/src/Bus.cpp @@ -395,6 +395,7 @@ void Bus::sendAsync(const CECFrame &frame) wQueue.offer((copyFrame)); } catch (...) { + CCEC_LOG( LOG_EXP, "Exception during copy frame offer...discarding\r\n"); delete copyFrame; throw; } From 1c6388cd2f03add88e3c48ee89d2921d6a713369 Mon Sep 17 00:00:00 2001 From: apatel859 Date: Wed, 17 Dec 2025 20:00:04 +0000 Subject: [PATCH 6/6] 1.0.8 release change log updates --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f343463..640d867 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.0.8](https://github.com/rdkcentral/hdmicec/compare/1.0.7...1.0.8) + +- RDKEMW-11021: fix the copilot static code analysis issues in hdmicec [`#42`](https://github.com/rdkcentral/hdmicec/pull/42) +- Update CODEOWNERS [`#40`](https://github.com/rdkcentral/hdmicec/pull/40) +- Deploy fossid_integration_stateless_diffscan_target_repo action [`#39`](https://github.com/rdkcentral/hdmicec/pull/39) +- Deploy cla action [`#21`](https://github.com/rdkcentral/hdmicec/pull/21) +- Merge tag '1.0.7' into develop [`51d878c`](https://github.com/rdkcentral/hdmicec/commit/51d878c268b58ffd3ded900f0bd3c397ffb6f74c) + #### [1.0.7](https://github.com/rdkcentral/hdmicec/compare/1.0.6...1.0.7) +> 22 September 2025 + +- 1.0.7 release change log updates [`de5193b`](https://github.com/rdkcentral/hdmicec/commit/de5193bf4c11001e21c060c00499e7538c10285b) - Merge pull request #36 from rdkcentral/topic/RDKEMW-6516-fix [`9dda320`](https://github.com/rdkcentral/hdmicec/commit/9dda3203ae90260c83bba9990273dba046053693) - Update DriverImpl.cpp [`1cbbf0e`](https://github.com/rdkcentral/hdmicec/commit/1cbbf0e7ee064503db93d56a0a8fb8d8bd4f7582) -- Merge tag '1.0.6' into develop [`7f9dc8c`](https://github.com/rdkcentral/hdmicec/commit/7f9dc8cfe935d2c9e0fcfa0e806ee795af8d52dd) #### [1.0.6](https://github.com/rdkcentral/hdmicec/compare/1.0.5...1.0.6)