Skip to content

[Enhancement] Remove wrong usage of const_cast #55057

Closed

Description

@zclllyybb

Search before asking

  • I had searched in the issues and found no similar issues.

Description

now in Doris we have some nonsense use of const_cast to remove the const-cv qualifier. like

char* dest_ptr = const_cast<char*>(src);

since we plan to write to the memory of src, it makes no sense to make it const char* and remove it in the function. it lead to some wrong use like
escape_string(test_str, &len, '\\');
, where we tried to write to a static memory region. it's a critical bug.

Solution

you should go through our whole be/ and find all const_cast. check if they make sense. (which I think most of them don't. for wrong usage, remove it. and leave a comment to others to explain why it's necessary.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. wumeibanfa commented on Aug 20, 2025

    @wumeibanfa
    Contributor

    please assign it to me

  2. zclllyybb commented on Aug 20, 2025

    @zclllyybb
    ContributorAuthor

    please assign it to me

    good! assigned~

  3. 2 remaining items

  4. added a commit that references this issue on Oct 26, 2025
  5. added a commit that references this issue on Oct 26, 2025
  6. zclllyybb commented on Nov 18, 2025

    @zclllyybb
    ContributorAuthor

    finally finished!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions