From 3ba16e4f0562e32cfffb786c1d74e8e49bb5e6de Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 8 Dec 2016 16:46:18 -0800 Subject: Fix bug whereby errors on a call do not lead to cancellation --- src/core/lib/slice/slice.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core/lib/slice') diff --git a/src/core/lib/slice/slice.c b/src/core/lib/slice/slice.c index f0ad9f4881..e77be6fc14 100644 --- a/src/core/lib/slice/slice.c +++ b/src/core/lib/slice/slice.c @@ -436,6 +436,8 @@ int grpc_slice_slice(grpc_slice haystack, grpc_slice needle) { if (haystack_len == 0 || needle_len == 0) return -1; if (haystack_len < needle_len) return -1; + if (haystack_len == needle_len) + return grpc_slice_eq(haystack, needle) ? 0 : -1; if (needle_len == 1) return grpc_slice_chr(haystack, (char)*needle_bytes); const uint8_t *last = haystack_bytes + haystack_len - needle_len; -- cgit v1.2.3