google / google/protobuf.dart

Freezing a message does not freeze bytes fields, allows modifying the message after the freeze

Open
#746 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Dart
Stars
572
Forks
196
Avg merge
1h 59m
Merged PRs (30d)
2

Description

We represent `bytes` fields as `Uint8List`, which doesn't support freezing. Repro:

```proto
syntax = "proto3";

message M1 {
bytes b = 1;
}
```

```dart
void main() {
M1 m = M1();
m.b = [0];
m.freeze();
m.b.add(1);
print(m);
}
```

Contributor guide

Open the contributing guide

Research direction

Start from the Dart message freeze entry point and the handling of bytes fields represented by Uint8List. Reproduce the issue with the provided M1 example, then verify that mutating m.b after m.freeze() is prevented and add coverage for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.