mbarbon / google-protobuf-dynamic

Fast and complete Perl protobuf implementation using uPB and Google .proto parser
35 stars 18 forks source link

Fix decoding of empty strings #10

Closed trinitum closed 7 years ago

trinitum commented 7 years ago

If protobuf contains empty string then on_start_string is called with size_hint set to 0, and on_string callback is never invoked, therefore SV is never initialized with any value and is undef. To fix that, this patch checks if size_hint is zero in on_start_string, and if it is then string is initialized with empty string.