Skip to content

[BUG]: Avoid nullptr access and subsequent deref#279

Merged
1a1a11a merged 3 commits intodevelopfrom
hxia/enum
Jul 26, 2025
Merged

[BUG]: Avoid nullptr access and subsequent deref#279
1a1a11a merged 3 commits intodevelopfrom
hxia/enum

Conversation

@haochengxia
Copy link
Collaborator

@haochengxia haochengxia commented Jul 25, 2025

In Analyzer, we will output op str, the nullptr will cause an error when deref

15 valid str + 242 invalid str

@haochengxia haochengxia requested a review from Copilot July 25, 2025 20:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a bug related to null pointer access when dereferencing operation strings in the Analyzer. The fix expands the req_op_str array to properly handle all possible values of the req_op_e enum, preventing potential segmentation faults when accessing invalid operation indices.

Key changes:

  • Expands the req_op_str array from 16 elements to 257 elements to match the full range of req_op_e enum values
  • Introduces macro definitions to efficiently populate the array with "invalid" strings for undefined operations

@haochengxia haochengxia requested a review from 1a1a11a July 25, 2025 20:29
@haochengxia
Copy link
Collaborator Author

For this issue, we can either change the value of OP_INVALID or fill the middle value. If we do not want to change enum.h, then we may need to change op.h (

for (int i = 0; i < OP_INVALID + 1; i++) {
).

Copy link
Owner

@1a1a11a 1a1a11a left a comment

Choose a reason for hiding this comment

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

LGTM

@1a1a11a 1a1a11a merged commit 2868881 into develop Jul 26, 2025
11 checks passed
@haochengxia haochengxia deleted the hxia/enum branch July 26, 2025 14:46
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.

3 participants