From d14dd4316d04f0982c340ad25bb283198a4d5c32 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 15 Mar 2018 15:21:57 +0000 Subject: Fixing order of guards to avoid potential segvs Per tspepez's drive by: str, in theory, might not be terminated, and might have been allocated right up to a guard page at the end of the heap, say, so that str[len] could segv. Change-Id: I6cba7b6d12b23f69e6f150c1b5296df65c2e0086 Reviewed-on: https://pdfium-review.googlesource.com/28610 Reviewed-by: dsinclair Commit-Queue: Ryan Harrison --- core/fxge/dib/fx_dib_main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index 1349e3e43c..161d2bd32e 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -97,7 +97,7 @@ FX_ARGB StringToFXARGB(const WideStringView& wsValue) { int cc = 0; const wchar_t* str = wsValue.unterminated_c_str(); int len = wsValue.GetLength(); - while (FXSYS_iswspace(str[cc]) && cc < len) + while (cc < len && FXSYS_iswspace(str[cc])) cc++; if (cc >= len) @@ -112,7 +112,7 @@ FX_ARGB StringToFXARGB(const WideStringView& wsValue) { } if (cc < len && str[cc] == ',') { cc++; - while (FXSYS_iswspace(str[cc]) && cc < len) + while (cc < len && FXSYS_iswspace(str[cc])) cc++; while (cc < len) { @@ -124,7 +124,7 @@ FX_ARGB StringToFXARGB(const WideStringView& wsValue) { } if (cc < len && str[cc] == ',') { cc++; - while (FXSYS_iswspace(str[cc]) && cc < len) + while (cc < len && FXSYS_iswspace(str[cc])) cc++; while (cc < len) { -- cgit v1.2.3