Skip to content

fix: enforce const-correctness in indexed_vector#3736

Open
vietcgi wants to merge 1 commit intofalcosecurity:masterfrom
vietcgi:fix/indexed-vector-const-correctness
Open

fix: enforce const-correctness in indexed_vector#3736
vietcgi wants to merge 1 commit intofalcosecurity:masterfrom
vietcgi:fix/indexed-vector-const-correctness

Conversation

@vietcgi
Copy link
Copy Markdown
Contributor

@vietcgi vietcgi commented Nov 12, 2025

Problem

Const at() methods were returning mutable pointers via const_cast, violating const-correctness.

Solution

  • Split at() methods into const/non-const overloads
  • Const version returns const T*, non-const returns T*
  • Updated callers to use const pointers where appropriate
  • Removed unsafe const_cast

Changes

  • indexed_vector.h: Added const/non-const overloads for both at() methods
  • rule_loader_compiler.cpp: Updated helper functions to return const pointers

Verified compilation and all call sites handle const-correctness properly.

@poiana
Copy link
Copy Markdown
Contributor

poiana commented Nov 12, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@poiana
Copy link
Copy Markdown
Contributor

poiana commented Nov 12, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vietcgi
Once this PR has been reviewed and has the lgtm label, please assign jasondellaluce for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana requested review from Andreagit97 and Kaizhe November 12, 2025 18:28
@github-actions
Copy link
Copy Markdown

This PR may bring feature or behavior changes in the Falco engine and may require the engine version to be bumped.

Please double check userspace/engine/falco_engine_version.h file. See versioning for FALCO_ENGINE_VERSION.

/hold

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

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants