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

Unified Diff: fpdfsdk/src/javascript/app.cpp

Issue 383563002: Fix an out-of-boundary issue for wide string (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 5 months 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
« no previous file with comments | « no previous file | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/app.cpp
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index a3e61c01abe6e22c593d8ab45b780d38779cdcc1..3cf3133b42bf83d791ab255a472b679481d01f9f 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -1111,10 +1111,8 @@ FX_BOOL app::response(OBJ_METHOD_PARAMS)
}
else
{
- nLength = nLength>2046?2046:nLength;
- pBuff[nLength] = 0;
- pBuff[nLength+1] = 0;
- swResponse = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLength);
+ nLength = nLength>2048?2048:nLength;
palmer 2014/07/10 19:10:55 Why 2048? It looks like you are removing the code
Bo Xu 2014/07/10 19:22:16 In line 1105, the pBuff is newed to be a length of
palmer 2014/07/11 00:12:29 So, does it matter if we effectively truncate the
Bo Xu 2014/07/11 03:02:38 The SDK only supports 2048 byte, so here is a hard
+ swResponse = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLength/2);
vRet = swResponse;
}
delete[] pBuff;
« no previous file with comments | « no previous file | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698