Skip to content

Fix a crash in mismatched output check for nested rules#1086

Merged
TristonianJones merged 1 commit into
cel-expr:masterfrom
seirl:fix_output_match_crash
Dec 5, 2024
Merged

Fix a crash in mismatched output check for nested rules#1086
TristonianJones merged 1 commit into
cel-expr:masterfrom
seirl:fix_output_match_crash

Conversation

@seirl

@seirl seirl commented Dec 5, 2024

Copy link
Copy Markdown
Collaborator

Minimal repro:

rule:
  match:
    - condition: "1 < 0"
      output: "true"
    - condition: "1 > 0"
      rule:
        match:
          - output: "'false'"

This would segfault the Policy Compiler, because it would try to access .Output().SourceID() of the second block to log an error, but .Output() is nil for nested rules.

@seirl
seirl force-pushed the fix_output_match_crash branch 2 times, most recently from bf2f3c1 to 5bcce86 Compare December 5, 2024 15:22
Minimal repro:

    rule:
      match:
        - condition: "1 < 0"
          output: "true"
        - condition: "1 > 0"
          rule:
            match:
              - output: "'false'"

This would segfault the Policy Compiler, because it would try to access
`.Output().SourceID()` of the second block to log an error, but
`.Output()` is nil for nested rules.
@seirl
seirl force-pushed the fix_output_match_crash branch from 5bcce86 to e0e5c50 Compare December 5, 2024 15:23
@TristonianJones
TristonianJones merged commit c096438 into cel-expr:master Dec 5, 2024
@seirl
seirl deleted the fix_output_match_crash branch December 5, 2024 15:39
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.

2 participants