stepancheg / rust-protobuf

Rust implementation of Google protocol buffers
MIT License
2.81k stars 382 forks source link

[text-format] Fix parsing of string literals #730

Open cmyr opened 5 months ago

cmyr commented 5 months ago

This renames next_byte_value to next_str_lit_bytes and changes the signature so that it returns between 1..=4 bytes per call, representing the variable-length nature of the UTF-8 encoding.

note: I'm not sure how best to add tests for this, and it needs it; in particular there should be a test case of a text-format input that contains a non-ascii string literal. There should probably also be more tests for the weird byte escapes? But definitely a case with non-ascii text.

stepancheg commented 5 months ago

Can you please add some test that would fail without this PR?

cmyr commented 5 months ago

I've added a test case that fails without this patch but passes with it.

stepancheg commented 2 months ago

Merged in bdc1428ea745097ea2d12fbc948de80420c77d9d.

stepancheg commented 2 months ago

It should be bumped tomorrow or so.