Skip to content

Unicode bug? #21

@FGasper

Description

@FGasper

Hello,

I’m looking over this library and notice a lot of use of plain SvPV. This causes Unicode-handling bugs, such as can be seen if you apply this patch:

diff --git a/t/01-call_credentials.t b/t/01-call_credentials.t
index c22dc5a..725a4f5 100644
--- a/t/01-call_credentials.t
+++ b/t/01-call_credentials.t
@@ -105,7 +105,8 @@ ok($event->{method} eq '/abc/dummy_method',"event->method has wrong value");
 # print STDERR "event=".Dumper($event);
 # Dump($event);

-my $status_text = 'xyz';
+my $status_text = "\xe9xyz";
+utf8::upgrade($status_text);
 my $server_call = $event->{call};
 $event = $server_call->startBatch(
     Grpc::Constants::GRPC_OP_SEND_INITIAL_METADATA() => {},

Am I right in thinking that all strings into and out of this module are meant to be byte buffers? That being the case, the sensible fix would be to replace SvPV and SvPV_nolen with SvPVbyte and SvPVbyte_nolen, respectively. It would be a breaking change, though, for anything that depends on the current behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions