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

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 1719493002: Revert "Use safe arithmentic in CFX_BinaryBuf::ExpandBuf." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « core/src/fxcrt/fx_basic_buffer.cpp ('k') | xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "fpdfsdk/include/fsdk_baseform.h" 7 #include "fpdfsdk/include/fsdk_baseform.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictBy("FDF"); 2454 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictBy("FDF");
2455 if (!pMainDict) 2455 if (!pMainDict)
2456 return FALSE; 2456 return FALSE;
2457 2457
2458 // Get fields 2458 // Get fields
2459 CPDF_Array* pFields = pMainDict->GetArrayBy("Fields"); 2459 CPDF_Array* pFields = pMainDict->GetArrayBy("Fields");
2460 if (!pFields) 2460 if (!pFields)
2461 return FALSE; 2461 return FALSE;
2462 2462
2463 CFX_ByteTextBuf fdfEncodedData; 2463 CFX_ByteTextBuf fdfEncodedData;
2464
2464 for (FX_DWORD i = 0; i < pFields->GetCount(); i++) { 2465 for (FX_DWORD i = 0; i < pFields->GetCount(); i++) {
2465 CPDF_Dictionary* pField = pFields->GetDictAt(i); 2466 CPDF_Dictionary* pField = pFields->GetDictAt(i);
2466 if (!pField) 2467 if (!pField)
2467 continue; 2468 continue;
2468 CFX_WideString name; 2469 CFX_WideString name;
2469 name = pField->GetUnicodeTextBy("T"); 2470 name = pField->GetUnicodeTextBy("T");
2470 CFX_ByteString name_b = CFX_ByteString::FromUnicode(name); 2471 CFX_ByteString name_b = CFX_ByteString::FromUnicode(name);
2471 CFX_ByteString csBValue = pField->GetStringBy("V"); 2472 CFX_ByteString csBValue = pField->GetStringBy("V");
2472 CFX_WideString csWValue = PDF_DecodeText(csBValue); 2473 CFX_WideString csWValue = PDF_DecodeText(csBValue);
2473 CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue); 2474 CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue);
2474 2475
2475 fdfEncodedData << name_b.GetBuffer(name_b.GetLength()); 2476 fdfEncodedData = fdfEncodedData << name_b.GetBuffer(name_b.GetLength());
2476 name_b.ReleaseBuffer(); 2477 name_b.ReleaseBuffer();
2477 fdfEncodedData << "="; 2478 fdfEncodedData = fdfEncodedData << "=";
2478 fdfEncodedData << csValue_b.GetBuffer(csValue_b.GetLength()); 2479 fdfEncodedData = fdfEncodedData
2480 << csValue_b.GetBuffer(csValue_b.GetLength());
2479 csValue_b.ReleaseBuffer(); 2481 csValue_b.ReleaseBuffer();
2480 if (i != pFields->GetCount() - 1) 2482 if (i != pFields->GetCount() - 1)
2481 fdfEncodedData << "&"; 2483 fdfEncodedData = fdfEncodedData << "&";
2482 } 2484 }
2483 2485
2484 nBufSize = fdfEncodedData.GetLength(); 2486 nBufSize = fdfEncodedData.GetLength();
2485 pBuf = FX_Alloc(uint8_t, nBufSize); 2487 pBuf = FX_Alloc(uint8_t, nBufSize);
2486 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); 2488 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
2487 } 2489 }
2488 return TRUE; 2490 return TRUE;
2489 } 2491 }
2490 2492
2491 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( 2493 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2873 break; 2875 break;
2874 } 2876 }
2875 } 2877 }
2876 } 2878 }
2877 2879
2878 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { 2880 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) {
2879 CPDF_Rect rcAnnot; 2881 CPDF_Rect rcAnnot;
2880 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); 2882 pAnnot->GetPDFAnnot()->GetRect(rcAnnot);
2881 return rcAnnot; 2883 return rcAnnot;
2882 } 2884 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_buffer.cpp ('k') | xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698