Skip to content

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

Open
Raju-krish wants to merge 1 commit into
rdkcentral:mainfrom
Raju-krish:main
Open

RDKB-65508, RDKB-65530: Crash with cJSON_Delete as signature#1236
Raju-krish wants to merge 1 commit into
rdkcentral:mainfrom
Raju-krish:main

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>
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 caused by accessing freed cJSON nodes after schema parsing by avoiding reference-based merges when resolving $ref (the parsed root schema is deleted at the end of parsing, so referenced nodes can become dangling).

Changes:

  • Replace cJSON_AddItemReferenceToObject() with a deep copy (cJSON_Duplicate(..., 1)) when merging referenced schema nodes into a base object.

💡 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