fix(expr): initialize MapLiteral KeyValue entries before use#235
Open
benbellick wants to merge 1 commit intomainfrom
Open
fix(expr): initialize MapLiteral KeyValue entries before use#235benbellick wants to merge 1 commit intomainfrom
benbellick wants to merge 1 commit intomainfrom
Conversation
MapLiteral.ToProtoLiteral allocated a []*Expression_Literal_Map_KeyValue with make, producing a slice of nil pointers, then wrote to kv[i].Key without first creating the element. Any non-empty map literal crashed with a nil pointer dereference when serialized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
==========================================
+ Coverage 68.84% 68.98% +0.13%
==========================================
Files 47 47
Lines 10862 10874 +12
==========================================
+ Hits 7478 7501 +23
+ Misses 3030 3017 -13
- Partials 354 356 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
606a77b to
f2441be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MapLiteral.ToProtoLiteral allocated kv := make([]*proto.Expression_Literal_Map_KeyValue, len(t.Value)) (a slice of nil pointers) and then wrote to kv[i].Key / kv[i].Value without creating each element. Any non-empty map literal panicked with a nil pointer dereference when serialized.