Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1214)

Unified Diff: xfa/fde/css/fde_cssdatatable.cpp

Issue 2535663003: Fix crash in CFDE_CSSSyntaxParser when parsing empty url (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/fde/css/fde_cssdatatable.cpp
diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp
index d2f81833e3dcacc15ae565a0099a4cd1c7d4c3be..b96f9106db97082298a0e1bc9249b32230769c5d 100644
--- a/xfa/fde/css/fde_cssdatatable.cpp
+++ b/xfa/fde/css/fde_cssdatatable.cpp
@@ -698,31 +698,29 @@ bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue,
bool FDE_ParseCSSString(const FX_WCHAR* pszValue,
int32_t iValueLen,
- int32_t& iOffset,
- int32_t& iLength) {
+ int32_t* iOffset,
+ int32_t* iLength) {
ASSERT(pszValue && iValueLen > 0);
- iOffset = 0;
- iLength = iValueLen;
+ *iOffset = 0;
+ *iLength = iValueLen;
if (iValueLen >= 2) {
FX_WCHAR first = pszValue[0], last = pszValue[iValueLen - 1];
- if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) {
- iOffset = 1, iLength -= 2;
- }
+ if ((first == '\"' && last == '\"') || (first == '\'' && last == '\''))
+ *iOffset = 1, *iLength -= 2;
Tom Sepez 2016/11/28 19:24:40 keep {} use ; not , and one per line.
npm 2016/11/28 20:35:45 Done.
}
return iValueLen > 0;
}
bool FDE_ParseCSSURI(const FX_WCHAR* pszValue,
- int32_t iValueLen,
- int32_t& iOffset,
- int32_t& iLength) {
- ASSERT(pszValue && iValueLen > 0);
- if (iValueLen < 6 || pszValue[iValueLen - 1] != ')' ||
+ int32_t* iOffset,
+ int32_t* iLength) {
+ ASSERT(pszValue && *iLength > 0);
+ if (*iLength < 6 || pszValue[*iLength - 1] != ')' ||
FXSYS_wcsnicmp(L"url(", pszValue, 4)) {
return false;
}
- if (FDE_ParseCSSString(pszValue + 4, iValueLen - 5, iOffset, iLength)) {
- iOffset += 4;
+ if (FDE_ParseCSSString(pszValue + 4, *iLength - 5, iOffset, iLength)) {
+ *iOffset += 4;
return true;
}
return false;

Powered by Google App Engine
This is Rietveld 408576698