From 1af7c4cb08defd2521d8552fd148932da08b2c46 Mon Sep 17 00:00:00 2001 From: Sergio Campama Date: Tue, 30 Aug 2016 11:55:49 -0700 Subject: Fixes static analyzer issues from xcode. --- src/google/protobuf/stubs/substitute.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/google/protobuf/stubs/substitute.cc') diff --git a/src/google/protobuf/stubs/substitute.cc b/src/google/protobuf/stubs/substitute.cc index c9d95899..7194a5b1 100644 --- a/src/google/protobuf/stubs/substitute.cc +++ b/src/google/protobuf/stubs/substitute.cc @@ -113,7 +113,9 @@ void SubstituteAndAppend( for (int i = 0; format[i] != '\0'; i++) { if (format[i] == '$') { if (ascii_isdigit(format[i+1])) { - const SubstituteArg* src = args_array[format[i+1] - '0']; + unsigned int index = format[i+1] - '0'; + assert(index < 10); + const SubstituteArg* src = args_array[index]; memcpy(target, src->data(), src->size()); target += src->size(); ++i; // Skip next char. -- cgit v1.2.3