Skip to content

Conversation

@osa1
Copy link
Member

@osa1 osa1 commented Nov 6, 2025

Currently PbMap does not check ranges of values added as keys or values.

This allows serializing and deserializing a message with a map and getting a
different map back, because PbMap allows adding values that are out of range
(e.g. an integer larger than 32-bit range as a sfixed32 value) but when
serializing it truncates the value.

Update PbMap to use the same validation functions as PbList when adding
elements. Both keys and values are checked.

Fixes #1065.


cl/836607306

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

Package publishing

Package Version Status Publish tag (post-merge)
package:protobuf 6.0.0 ready to publish protobuf-v6.0.0
package:protoc_plugin 25.0.0 ready to publish protoc_plugin-v25.0.0

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

@osa1 osa1 changed the title Start checking keys and values in PbMap Check key and value validity in PbMap Nov 24, 2025
@osa1 osa1 marked this pull request as ready for review November 24, 2025 14:15
@osa1 osa1 requested a review from sigurdm November 24, 2025 14:15
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.

Possible to create PbLists without value validity checks, PbMap does not validate elements

2 participants