Skip to content
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

Bug with constant propagation #10085

Open
1 of 3 tasks
ahpaleus opened this issue Apr 11, 2024 · 1 comment
Open
1 of 3 tasks

Bug with constant propagation #10085

ahpaleus opened this issue Apr 11, 2024 · 1 comment

Comments

@ahpaleus
Copy link

Describe the bug
The metavariable-comparison does not work as expected. It should also match when a value in the index 'comes from' a variable.

To Reproduce
https://semgrep.dev/playground/s/NbJPp

Expected behavior
The 9th line should be caught.

What is the priority of the bug to you?

  • P0: blocking your adoption of Semgrep or workflow
  • P1: important to fix or quite annoying
  • P2: regular bug that should get fixed
@mjambon
Copy link
Member

mjambon commented Apr 11, 2024

Thanks for reporting this bug. It looks like constant propagation doesn't work for variables occurring in array slices e.g. x isn't replaced by its value in a[1:x] but it works for simple array indices such as a[x].

image

Here's the playground link for future reference: https://semgrep.dev/playground/s/ReAdE

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

No branches or pull requests

2 participants