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

Issue 1710403002: Use safe arithmentic in CFX_BinaryBuf::ExpandBuf. (Closed)

Created:
4 years, 10 months ago by Tom Sepez
Modified:
4 years, 10 months ago
Reviewers:
Lei Zhang
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

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 Committed: https://pdfium.googlesource.com/pdfium/+/78353d5dbc0b0c9b2d6946005439a51efa7d108c

Patch Set 1 #

Patch Set 2 : Move string methods to subclass. #

Patch Set 3 : Reorder members. #

Patch Set 4 : Add comments about ownership #

Patch Set 5 : Use result. #

Patch Set 6 : Unique_ptr, safe arithmetic. #

Total comments: 4

Patch Set 7 : needless uint8_t casts. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+145 lines, -188 lines) Patch
M core/include/fxcrt/fx_basic.h View 1 2 3 4 5 3 chunks +41 lines, -69 lines 0 comments Download
M core/include/fxcrt/fx_safe_types.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp View 1 2 3 4 5 6 3 chunks +3 lines, -3 lines 0 comments Download
M core/src/fxcodec/codec/fx_codec_fax.cpp View 1 2 3 4 1 chunk +1 line, -2 lines 0 comments Download
M core/src/fxcrt/fx_basic_buffer.cpp View 1 2 3 4 5 1 chunk +76 lines, -98 lines 0 comments Download
M fpdfsdk/src/fsdk_baseform.cpp View 1 2 3 4 5 2 chunks +4 lines, -6 lines 0 comments Download
M xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp View 6 chunks +17 lines, -8 lines 0 comments Download
M xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp View 1 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 11 (6 generated)
Tom Sepez
Lei, for review. And this started out so simply ...
4 years, 10 months ago (2016-02-19 19:54:04 UTC) #6
Lei Zhang
https://codereview.chromium.org/1710403002/diff/100001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp File core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp (right): https://codereview.chromium.org/1710403002/diff/100001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp#newcode1898 core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp:1898: buf.AppendByte((uint8_t)code); If you are using CFX_ByteTextBuf, then AppendChar() here ...
4 years, 10 months ago (2016-02-19 22:05:21 UTC) #7
Tom Sepez
https://codereview.chromium.org/1710403002/diff/100001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp File core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp (right): https://codereview.chromium.org/1710403002/diff/100001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp#newcode1898 core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp:1898: buf.AppendByte((uint8_t)code); On 2016/02/19 22:05:21, Lei Zhang wrote: > If ...
4 years, 10 months ago (2016-02-19 22:17:19 UTC) #8
Lei Zhang
lgtm
4 years, 10 months ago (2016-02-19 22:20:18 UTC) #9
Tom Sepez
4 years, 10 months ago (2016-02-19 22:23:03 UTC) #11
Message was sent while issue was closed.
Committed patchset #7 (id:120001) manually as
78353d5dbc0b0c9b2d6946005439a51efa7d108c (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698