From 5dd0d6fadb20f297ec04753a19f1e2a2fd03735d Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 7 Nov 2017 17:18:55 -0800 Subject: Fix internal UBSAN failure --- src/core/ext/filters/client_channel/uri_parser.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/uri_parser.cc b/src/core/ext/filters/client_channel/uri_parser.cc index 917e65342b..1cc52dec12 100644 --- a/src/core/ext/filters/client_channel/uri_parser.cc +++ b/src/core/ext/filters/client_channel/uri_parser.cc @@ -59,7 +59,9 @@ static grpc_uri* bad_uri(const char* uri_text, size_t pos, const char* section, static char* decode_and_copy_component(grpc_exec_ctx* exec_ctx, const char* src, size_t begin, size_t end) { grpc_slice component = - grpc_slice_from_copied_buffer(src + begin, end - begin); + (begin == NOT_SET || end == NOT_SET) + ? grpc_empty_slice() + : grpc_slice_from_copied_buffer(src + begin, end - begin); grpc_slice decoded_component = grpc_permissive_percent_decode_slice(component); char* out = grpc_dump_slice(decoded_component, GPR_DUMP_ASCII); -- cgit v1.2.3