From f1d9955540076e044905afb3fd6dbc03034aacd3 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 8 Feb 2017 11:49:25 -0600 Subject: COMMON: Fix calling Span::getStringAt with non-zero index --- common/span.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/span.h b/common/span.h index 0bb5a25972..2acc0b5fe7 100644 --- a/common/span.h +++ b/common/span.h @@ -393,14 +393,14 @@ public: inline String getStringAt(const index_type index, size_type numEntries = kSpanMaxSize) const { STATIC_ASSERT(sizeof(value_type) == sizeof(char), strings_can_only_be_read_from_byte_or_char_spans); - const char *string = (const char *)impl().data(); + const char *string = (const char *)impl().data() + index; if (numEntries == kSpanMaxSize) { numEntries = strnlen(string, impl().size() - index); } impl().validate(index, numEntries); - return String(string + index, numEntries); + return String(string, numEntries); } /** -- cgit v1.2.3