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

Side by Side Diff: fpdfsdk/src/jsapi/fxjs_v8.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../core/include/fxcrt/fx_basic.h" 7 #include "../../../core/include/fxcrt/fx_basic.h"
8 #include "../../../core/include/fxcrt/fx_ext.h" 8 #include "../../../core/include/fxcrt/fx_ext.h"
9 #include "../../include/jsapi/fxjs_v8.h" 9 #include "../../include/jsapi/fxjs_v8.h"
10 #include "../../include/fsdk_define.h" 10 #include "../../include/fsdk_define.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 v8::Handle<v8::Object> JS_ToObject(v8::Handle<v8::Value> pValue) 727 v8::Handle<v8::Object> JS_ToObject(v8::Handle<v8::Value> pValue)
728 { 728 {
729 if(pValue.IsEmpty()) return v8::Handle<v8::Object>(); 729 if(pValue.IsEmpty()) return v8::Handle<v8::Object>();
730 return pValue->ToObject(); 730 return pValue->ToObject();
731 } 731 }
732 732
733 CFX_WideString JS_ToString(v8::Handle<v8::Value> pValue) 733 CFX_WideString JS_ToString(v8::Handle<v8::Value> pValue)
734 { 734 {
735 if(pValue.IsEmpty()) return L""; 735 if(pValue.IsEmpty()) return L"";
736 v8::String::Utf8Value s(pValue->ToString()); 736 v8::String::Utf8Value s(pValue->ToString());
737 » return CFX_WideString::FromUTF8(*s); 737 » return CFX_WideString::FromUTF8(*s, s.length());
palmer 2014/07/10 19:10:55 Ahh, I see, FromUTF8 has the same behavior. There
738 } 738 }
739 739
740 v8::Handle<v8::Array> JS_ToArray(v8::Handle<v8::Value> pValue) 740 v8::Handle<v8::Array> JS_ToArray(v8::Handle<v8::Value> pValue)
741 { 741 {
742 if(pValue.IsEmpty()) return v8::Handle<v8::Array>(); 742 if(pValue.IsEmpty()) return v8::Handle<v8::Array>();
743 return v8::Handle<v8::Array>::Cast(pValue->ToObject()); 743 return v8::Handle<v8::Array>::Cast(pValue->ToObject());
744 } 744 }
745 745
746 void JS_ValueCopy(v8::Handle<v8::Value>& pTo, v8::Handle<v8::Value> pFrom) 746 void JS_ValueCopy(v8::Handle<v8::Value>& pTo, v8::Handle<v8::Value> pFrom)
747 { 747 {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 { 1034 {
1035 return d != d; 1035 return d != d;
1036 } 1036 }
1037 1037
1038 double JS_LocalTime(double d) 1038 double JS_LocalTime(double d)
1039 { 1039 {
1040 return JS_GetDateTime() + _getDaylightSavingTA(d); 1040 return JS_GetDateTime() + _getDaylightSavingTA(d);
1041 } 1041 }
1042 1042
1043 //JavaScript time implement End. 1043 //JavaScript time implement End.
OLDNEW
« fpdfsdk/src/javascript/app.cpp ('K') | « fpdfsdk/src/javascript/app.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698