Skip to content

RDKB-65508, RDKB-65530: Crash with cJSON_Delete as signature#1235

Open
Raju-krish wants to merge 1 commit into
rdkcentral:developfrom
Raju-krish:develop
Open

RDKB-65508, RDKB-65530: Crash with cJSON_Delete as signature#1235
Raju-krish wants to merge 1 commit into
rdkcentral:developfrom
Raju-krish:develop

Conversation

@Raju-krish

Copy link
Copy Markdown
Contributor

Reason for change: Crash occurs because of accessing dangling pointer.
Test Procedure: Build should be successful, Crash shouldn't occur.
Risks: Low
Priority: P1

Reason for change: Crash occurs because of accessing dangling pointer.
Test Procedure: Build should be successful, Crash shouldn't occur.
Risks: Low
Priority: P1
Signed-off-by: Rajagopalaswamy M <mrajagopalaswamy@gmail.com>
@Raju-krish Raju-krish requested a review from a team as a code owner June 29, 2026 10:52
Copilot AI review requested due to automatic review settings June 29, 2026 10:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in the JSON schema parser caused by merging referenced nodes via cJSON references, which can leave dangling pointers when referenced objects are later modified/deleted during $ref resolution.

Changes:

  • Replace cJSON_AddItemReferenceToObject() with a deep copy (cJSON_Duplicate(..., recurse)) when merging missing keys from referenced schema nodes.
  • Keep recursive merge behavior for "properties" objects while avoiding shared ownership of cJSON subtrees.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +181 to +184
cJSON* copy = cJSON_Duplicate(child, 1);
if (copy) {
cJSON_AddItemToObject(base, child->string, copy);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants