Skip to content

Add nullptr checking for rename logging #16059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged

Conversation

henryhchchc
Copy link
Contributor

There is a segmentation fault during a rename when the position is not pointing to a valid symbol. Add a checking to avoid that.

POC:

function id(uint x) pure returns (uint) {
    return x;
}

function zero(uint) pure returns (uint) {
    return 0;
}

contract C {
    function f(uint z) pure external returns(uint) {
        return z.id();
    }

    function g(uint z) pure external returns (uint) {
        return z.zero();
    }

    using {id, zero} for uint;
}
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "textDocument/rename",
  "params": {
    "textDocument": {
      "uri": "file:///tmp/export/input_2/workspace/main.sol"
    },
    "position": {
      "line": 10,
      "character": 20
    },
    "newName": "pure"
  }
}

Copy link

Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.

@henryhchchc henryhchchc force-pushed the develop branch 3 times, most recently from 503f50b to 0237583 Compare May 20, 2025 05:40
Copy link
Member

@clonker clonker left a comment

Choose a reason for hiding this comment

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

Thanks!

@clonker clonker merged commit d6a396e into ethereum:develop May 21, 2025
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants