Change length calculation in CFX_StringCTemplate constructor

Originally this would only calculate the length of the passed in
string if the passed in length was -1. This causes issues, since other
negative values will be passed straight through and break the
post-condition on the constructor of the length being
non-negative. This leads to undefined and hard to debug behaviour
later, in cases where the root cause is a mistake in calculating the
proper length.

The other related classes, CFX_WideString & CFX_ByteString, test for
all negative length values and calculating the length when they
occur. This CL changes the FooC versions to use this logic. This
implicitly assumes the string is null terminated, so in the incase of
an incorrect negative length and a non-null terminated string there
will still be a crash, but it will now occur at construction time,
instead of at some random later time.

BUG=pdfium:827

Change-Id: I4d1fed746ada67c496d8e6ab10861b9332555023
Reviewed-on: https://pdfium-review.googlesource.com/8450
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/core/fxcrt/cfx_string_c_template.h b/core/fxcrt/cfx_string_c_template.h
index 1473160..cd3cd27 100644
--- a/core/fxcrt/cfx_string_c_template.h
+++ b/core/fxcrt/cfx_string_c_template.h
@@ -35,7 +35,7 @@
 
   CFX_StringCTemplate(const CharType* ptr, FX_STRSIZE len)
       : m_Ptr(reinterpret_cast<const UnsignedType*>(ptr)),
-        m_Length(len == -1 ? FXSYS_len(ptr) : len) {}
+        m_Length(len < 0 ? FXSYS_len(ptr) : len) {}
 
   template <typename U = UnsignedType>
   CFX_StringCTemplate(