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

Issue 652063002: Don't leave dangling pointer to out-of-scope local in CPDF_StreamContentParser::Parse. (Closed)

Created:
6 years, 2 months ago by Tom Sepez
Modified:
6 years, 2 months ago
Reviewers:
Bo Xu, jun_fang
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Visibility:
Public.

Description

Don't leave dangling pointer to out-of-scope local in CPDF_StreamContentParser::Parse. This is just a bit of defensive programming; I'm not sure the situation can occur in the current code, but the following code is likely to set off a red flag to anyone who reads it: CPDF_StreamParser syntax(pData, dwSize); m_pSyntax = &syntax; since the extent of the local |syntax| is far less than the pointer member |m_pSyntax|. NULL it out before syntax goes out of scope. R=jun_fang@foxitsoftware.com Committed: https://pdfium.googlesource.com/pdfium/+/35d720aff01c5ea778c16ac1e31c56f68490f10b

Patch Set 1 #

Patch Set 2 : untabify #

Total comments: 5

Patch Set 3 : Use C++ technique #

Patch Set 4 : Untabify #

Patch Set 5 : Use CPDF_ prefix. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -1 line) Patch
M core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp View 1 2 3 4 2 chunks +11 lines, -1 line 1 comment Download

Messages

Total messages: 9 (1 generated)
Tom Sepez
Please review. Just something that could be a problem somday.
6 years, 2 months ago (2014-10-13 23:50:42 UTC) #2
Bo Xu
https://codereview.chromium.org/652063002/diff/20001/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp File core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp (right): https://codereview.chromium.org/652063002/diff/20001/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp#newcode72 core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp:72: return result; In all the lines above having "return ...
6 years, 2 months ago (2014-10-14 00:17:23 UTC) #3
jun_fang
https://codereview.chromium.org/652063002/diff/20001/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp File core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp (right): https://codereview.chromium.org/652063002/diff/20001/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp#newcode43 core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp:43: while (1) { FX_BOOL bContinue = TRUE; while (bContinue) ...
6 years, 2 months ago (2014-10-14 00:30:43 UTC) #4
Tom Sepez
Ah, yes, good spotting there Bo and Jun, I'd missed those returns. In cases like ...
6 years, 2 months ago (2014-10-14 16:54:06 UTC) #5
jun_fang
On 2014/10/14 16:54:06, Tom Sepez wrote: > Ah, yes, good spotting there Bo and Jun, ...
6 years, 2 months ago (2014-10-14 20:49:42 UTC) #6
jun_fang
https://codereview.chromium.org/652063002/diff/80001/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp File core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp (right): https://codereview.chromium.org/652063002/diff/80001/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp#newcode38 core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp:38: *scoped_variable_ = new_parser; nit: shall we check whether scoped_variable_ ...
6 years, 2 months ago (2014-10-14 20:54:08 UTC) #7
Tom Sepez
> nit: shall we check whether scoped_variable_ is not NULL? I don't think we need ...
6 years, 2 months ago (2014-10-14 21:23:02 UTC) #8
Tom Sepez
6 years, 2 months ago (2014-10-14 21:41:01 UTC) #9
Message was sent while issue was closed.
Committed patchset #5 (id:80001) manually as
35d720aff01c5ea778c16ac1e31c56f68490f10b (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698