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

Issue 322333002: Fix the potential integer overflow from "offset + size" (Closed)

Created:
6 years, 6 months ago by jun_fang
Modified:
6 years, 5 months ago
Reviewers:
palmer, jschuh
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Visibility:
Public.

Description

This change is for fixing the potential integer overflow from "offset + size" BUG=382667 R=palmer@chromium.org Committed: https://pdfium.googlesource.com/pdfium/+/3414a64

Patch Set 1 #

Total comments: 3

Patch Set 2 : check integer overflow with numeric #

Patch Set 3 : #

Total comments: 6

Patch Set 4 : #

Total comments: 9

Patch Set 5 : #

Patch Set 6 : some formats in the fix of offest+size #

Unified diffs Side-by-side diffs Delta from patch set Stats (+85 lines, -33 lines) Patch
M core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp View 1 2 3 4 5 2 chunks +48 lines, -26 lines 0 comments Download
M core/src/fxcrt/extension.h View 1 2 3 4 5 5 chunks +37 lines, -7 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
jun_fang
You are invited to review code change for fixing the potential integer overflow from "offset ...
6 years, 6 months ago (2014-06-11 07:13:49 UTC) #1
palmer
https://codereview.chromium.org/322333002/diff/1/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp File core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp (right): https://codereview.chromium.org/322333002/diff/1/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp#newcode2858 core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp:2858: if(size <= 0 || offset < 0 || offset ...
6 years, 6 months ago (2014-06-12 00:32:05 UTC) #2
palmer
Any update on this patch?
6 years, 5 months ago (2014-07-07 20:57:49 UTC) #3
jun_fang
https://codereview.chromium.org/322333002/diff/1/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp File core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp (right): https://codereview.chromium.org/322333002/diff/1/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp#newcode2858 core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp:2858: if(size <= 0 || offset < 0 || offset ...
6 years, 5 months ago (2014-07-08 17:43:11 UTC) #4
jun_fang
6 years, 5 months ago (2014-07-09 06:59:59 UTC) #5
palmer
https://codereview.chromium.org/322333002/diff/40001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp File core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp (right): https://codereview.chromium.org/322333002/diff/40001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp#newcode2872 core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp:2872: base::CheckedNumeric<FX_DWORD> safe_size = size; You should check the value ...
6 years, 5 months ago (2014-07-09 18:29:15 UTC) #6
palmer
> safe_size += offset; > safe_size += 512; > if (!safe_size.IsValid()) { > break; > ...
6 years, 5 months ago (2014-07-09 18:30:14 UTC) #7
jun_fang
https://codereview.chromium.org/322333002/diff/40001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp File core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp (right): https://codereview.chromium.org/322333002/diff/40001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp#newcode2872 core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp:2872: base::CheckedNumeric<FX_DWORD> safe_size = size; On 2014/07/09 18:29:14, Chromium Palmer ...
6 years, 5 months ago (2014-07-10 22:21:55 UTC) #8
palmer
> safe_size is a temporary variable which is used to judge whether the result of ...
6 years, 5 months ago (2014-07-10 22:47:16 UTC) #9
palmer
+jschuh to make sure I am on the right track.
6 years, 5 months ago (2014-07-10 22:47:44 UTC) #10
jun_fang
On 2014/07/10 22:47:16, Chromium Palmer wrote: > > safe_size is a temporary variable which is ...
6 years, 5 months ago (2014-07-14 05:41:11 UTC) #11
palmer
See https://codereview.chromium.org/390983007/ for my approach.
6 years, 5 months ago (2014-07-15 01:52:24 UTC) #12
jschuh
On 2014/07/15 01:52:24, Chromium Palmer wrote: > See https://codereview.chromium.org/390983007/ for my approach. Yep, that is ...
6 years, 5 months ago (2014-07-17 00:06:58 UTC) #13
jun_fang
6 years, 5 months ago (2014-07-18 23:14:46 UTC) #14
jun_fang
On 2014/07/18 23:14:46, jun_fang wrote: ping Chris. This fix covers more "offset + size". Can ...
6 years, 5 months ago (2014-07-23 17:35:14 UTC) #15
palmer
https://codereview.chromium.org/322333002/diff/60001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp File core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp (right): https://codereview.chromium.org/322333002/diff/60001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp#newcode2868 core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp:2868: base::CheckedNumeric<FX_DWORD> size = original_size; I've already checked in this ...
6 years, 5 months ago (2014-07-23 17:58:37 UTC) #16
jun_fang
https://codereview.chromium.org/322333002/diff/60001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp File core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp (right): https://codereview.chromium.org/322333002/diff/60001/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp#newcode2868 core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp:2868: base::CheckedNumeric<FX_DWORD> size = original_size; On 2014/07/23 17:58:36, Chromium Palmer ...
6 years, 5 months ago (2014-07-24 07:14:39 UTC) #17
jschuh
https://codereview.chromium.org/322333002/diff/60001/core/src/fxcrt/extension.h File core/src/fxcrt/extension.h (right): https://codereview.chromium.org/322333002/diff/60001/core/src/fxcrt/extension.h#newcode221 core/src/fxcrt/extension.h:221: if (newPos.ValueOrDefault(0) == 0 || newPos.ValueOrDie() > m_nCurSize) { ...
6 years, 5 months ago (2014-07-24 13:48:46 UTC) #18
jun_fang
Hi Chris, please review it. Thanks!
6 years, 5 months ago (2014-07-24 17:52:08 UTC) #19
palmer
lgtm
6 years, 5 months ago (2014-07-24 18:40:30 UTC) #20
jun_fang
6 years, 5 months ago (2014-07-24 19:20:18 UTC) #21
Message was sent while issue was closed.
Committed patchset #6 manually as r3414a64 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698