diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-19 14:22:56 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-19 14:22:56 -0800 |
commit | 78353d5dbc0b0c9b2d6946005439a51efa7d108c (patch) | |
tree | 2d0048714b8630cd22b2f8e3129318ed93ee945d /fpdfsdk/src/fsdk_baseform.cpp | |
parent | 711046ac7043ebeec2b0c9a5eb168418cd07a876 (diff) | |
download | pdfium-78353d5dbc0b0c9b2d6946005439a51efa7d108c.tar.xz |
Use safe arithmentic in CFX_BinaryBuf::ExpandBuf.
Always call ExpandBuf(), and if it returns, we know the
subsequent calculations won't overflow.
Also use std::unique_ptr, and fix unintentional copies thus
detected by its suppressed copy ctor in fsdk_baseform.cpp
Also Remove unused CFX_BinaryBuf::TakeOver(), AppendFill(), CopyData().
Also remove operator= in favor of using <<, for similarity
with std::ostream and friends.
Also move ByteStringC methods to CFX_ByteTextBuf sub-class.
Also re-order members, may pack tighter on 64-bits.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1710403002 .
Diffstat (limited to 'fpdfsdk/src/fsdk_baseform.cpp')
-rw-r--r-- | fpdfsdk/src/fsdk_baseform.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 00ab6c2ef0..f05545a672 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -2461,7 +2461,6 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, return FALSE; CFX_ByteTextBuf fdfEncodedData; - for (FX_DWORD i = 0; i < pFields->GetCount(); i++) { CPDF_Dictionary* pField = pFields->GetDictAt(i); if (!pField) @@ -2473,14 +2472,13 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, CFX_WideString csWValue = PDF_DecodeText(csBValue); CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue); - fdfEncodedData = fdfEncodedData << name_b.GetBuffer(name_b.GetLength()); + fdfEncodedData << name_b.GetBuffer(name_b.GetLength()); name_b.ReleaseBuffer(); - fdfEncodedData = fdfEncodedData << "="; - fdfEncodedData = fdfEncodedData - << csValue_b.GetBuffer(csValue_b.GetLength()); + fdfEncodedData << "="; + fdfEncodedData << csValue_b.GetBuffer(csValue_b.GetLength()); csValue_b.ReleaseBuffer(); if (i != pFields->GetCount() - 1) - fdfEncodedData = fdfEncodedData << "&"; + fdfEncodedData << "&"; } nBufSize = fdfEncodedData.GetLength(); |