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

Fix nil pointer exceptions in certain broken dependency scenarios #908

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

LloydW93
Copy link
Contributor

When there are one or more broken dependency problems, the final value of dep when evaluating all entries is the one used when preparing the problem item.

However, it is possible that after a problem is identified, subsequent entries are recording or alerting rules which either do not have any vector selectors, or none that match.

In this situation, the final value of dep is nil, which causes a crash.

This change fixes this by using the first broken dependency entry recorded for building this part of the string.

When there are one or more broken dependency problems, the final
value of `dep` when evaluating all entries is the one used when
preparing the problem item.

However, it is possible that after a problem is identified,
subsequent entries are recording or alerting rules which either
do not have any vector selectors, or none that match.

In this situation, the final value of `dep` is `nil`, which causes
a crash.

This change fixes this by using the first broken dependency entry
recorded for building this part of the string.
@LloydW93 LloydW93 requested a review from prymitive as a code owner March 13, 2024 13:25
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.86%. Comparing base (7cea6a7) to head (c3716b0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #908   +/-   ##
=======================================
  Coverage   94.86%   94.86%           
=======================================
  Files          93       93           
  Lines        8797     8797           
=======================================
  Hits         8345     8345           
  Misses        311      311           
  Partials      141      141           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@prymitive prymitive merged commit eb933aa into cloudflare:main Mar 14, 2024
17 of 18 checks passed
@LloydW93 LloydW93 deleted the lloyd/depcheck-segfault branch March 14, 2024 21:54
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.

3 participants