Skip to content

fix(expr): initialize MapLiteral KeyValue entries before use#235

Open
benbellick wants to merge 1 commit intomainfrom
benbellick/fix-map-literal-nil-deref
Open

fix(expr): initialize MapLiteral KeyValue entries before use#235
benbellick wants to merge 1 commit intomainfrom
benbellick/fix-map-literal-nil-deref

Conversation

@benbellick
Copy link
Copy Markdown
Member

@benbellick benbellick commented Apr 21, 2026

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.

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
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.98%. Comparing base (5073366) to head (606a77b).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@benbellick benbellick changed the title fix(expr): initialize MapLiteral KeyValue entries before use fix(expr): MapLiteral.ToProtoLiteral nil-deref, add NewMap helpers Apr 21, 2026
@benbellick benbellick changed the title fix(expr): MapLiteral.ToProtoLiteral nil-deref, add NewMap helpers fix(expr): MapLiteral.ToProtoLiteral nil-deref, add NewMap helper Apr 21, 2026
@benbellick benbellick force-pushed the benbellick/fix-map-literal-nil-deref branch from 606a77b to f2441be Compare April 21, 2026 15:00
@benbellick benbellick changed the title fix(expr): MapLiteral.ToProtoLiteral nil-deref, add NewMap helper fix(expr): initialize MapLiteral KeyValue entries before use Apr 21, 2026
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.

1 participant