Fix integer overflow in cJSON_GetArraySize by using size_t#1
Fix integer overflow in cJSON_GetArraySize by using size_t#1Will-gabia wants to merge 1 commit intomasterfrom
Conversation
Changed cJSON_GetArraySize return type from int to size_t to support large arrays. Updated cJSON_GetArrayItem, cJSON_DetachItemFromArray, cJSON_DeleteItemFromArray, cJSON_InsertItemInArray, and cJSON_ReplaceItemInArray to accept size_t index/which parameter to match the larger size support. This is an API breaking change as requested to fix the overflow issue. Co-authored-by: Will-gabia <57982457+Will-gabia@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR addresses a potential integer overflow in
cJSON_GetArraySizewhere returning anintfor arrays larger thanINT_MAXwould cause truncation or overflow.Changes:
cJSON_GetArraySizeinsrc/cJSON.candsrc/include/switch_cJSON.hto returnsize_t.cJSON_GetArrayItem,cJSON_DetachItemFromArray,cJSON_DeleteItemFromArray,cJSON_InsertItemInArray,cJSON_ReplaceItemInArray) to acceptsize_tfor the index parameter. This ensures that large arrays can be accessed and manipulated correctly.size_tis unsigned.Verification:
PR created automatically by Jules for task 2124603859890423596 started by @Will-gabia