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

Issue 656753002: Store the address of the page data map's value for proper referencing. (Closed)

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

Description

Store the address of the page data map's value for proper referencing. CPDF_Pattern objects are counted and maintained in m_PatternedMap. When a CPDF_Pattern object "pattern" is deleted, it's address is marked as NULL in m_PatternMap. This patch stores the address of CPDF_Pattern's adderss in all objects that references "pattern", to ensure valid referencing after deletion. BUG=416319, 419976, 418392 R=tsepez@chromium.org Committed: https://pdfium.googlesource.com/pdfium/+/e1177425a656f915657f948d965193a019702a52

Patch Set 1 #

Patch Set 2 : Clean up #

Total comments: 4

Patch Set 3 : Store counted objects as member #

Total comments: 7

Patch Set 4 : typedef #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+124 lines, -41 lines) Patch
M core/include/fpdfapi/fpdf_resource.h View 1 2 3 2 chunks +24 lines, -1 line 0 comments Download
M core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp View 1 2 10 chunks +27 lines, -4 lines 0 comments Download
M core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp View 1 2 3 5 chunks +61 lines, -21 lines 2 comments Download
M core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp View 1 2 3 chunks +7 lines, -2 lines 0 comments Download
M core/src/fpdfapi/fpdf_page/pageint.h View 1 2 3 chunks +5 lines, -13 lines 0 comments Download

Messages

Total messages: 16 (1 generated)
Bo Xu
Hi Tom, I tested the patch on past security issues, did not see regression.
6 years, 2 months ago (2014-10-14 17:13:27 UTC) #2
Tom Sepez
Seems like the right fix is that the color object should hold a pointer to ...
6 years, 2 months ago (2014-10-14 18:49:23 UTC) #3
Tom Sepez
https://codereview.chromium.org/656753002/diff/20001/core/src/fpdfapi/fpdf_page/pageint.h File core/src/fpdfapi/fpdf_page/pageint.h (right): https://codereview.chromium.org/656753002/diff/20001/core/src/fpdfapi/fpdf_page/pageint.h#newcode434 core/src/fpdfapi/fpdf_page/pageint.h:434: CPDF_ColorSpace** FindColorSpacePtr(CPDF_Object* pCSObj); nit: are these const methods? Is ...
6 years, 2 months ago (2014-10-14 20:39:31 UTC) #4
Bo Xu
https://codereview.chromium.org/656753002/diff/20001/core/include/fpdfapi/fpdf_resource.h File core/include/fpdfapi/fpdf_resource.h (right): https://codereview.chromium.org/656753002/diff/20001/core/include/fpdfapi/fpdf_resource.h#newcode795 core/include/fpdfapi/fpdf_resource.h:795: CPDF_ColorSpace** m_pPtrCS; On 2014/10/14 18:49:23, Tom Sepez wrote: > ...
6 years, 2 months ago (2014-10-14 20:41:06 UTC) #5
Bo Xu
https://codereview.chromium.org/656753002/diff/20001/core/src/fpdfapi/fpdf_page/pageint.h File core/src/fpdfapi/fpdf_page/pageint.h (right): https://codereview.chromium.org/656753002/diff/20001/core/src/fpdfapi/fpdf_page/pageint.h#newcode434 core/src/fpdfapi/fpdf_page/pageint.h:434: CPDF_ColorSpace** FindColorSpacePtr(CPDF_Object* pCSObj); On 2014/10/14 20:39:31, Tom Sepez wrote: ...
6 years, 2 months ago (2014-10-14 20:53:34 UTC) #6
Tom Sepez
Gotcha. Your map is actually a map<CPDF_Object*, CPDF_CountedObject<CPDF_ColorSpace*>*>, so I'd prefer that you had: CPDF_CountedObject<CPDF_ColorSpace*>* ...
6 years, 2 months ago (2014-10-14 21:01:34 UTC) #7
Tom Sepez
In other words, I'd someday like to change this to: std::map<CPDF_Object*, std::shared_ptr<CPDF_ColorSpace>> m_ColorSpaceMap; and: std::shared_ptr<CPDF_ColorSpace> ...
6 years, 2 months ago (2014-10-14 21:18:23 UTC) #8
Bo Xu
On 2014/10/14 21:01:34, Tom Sepez wrote: > Gotcha. Your map is actually a map<CPDF_Object*, > ...
6 years, 2 months ago (2014-10-14 21:21:07 UTC) #9
Bo Xu
On 2014/10/14 21:18:23, Tom Sepez wrote: > In other words, I'd someday like to change ...
6 years, 2 months ago (2014-10-14 22:47:00 UTC) #10
Tom Sepez
I think this is getting close. Just some nits plus one question. You needn't consider ...
6 years, 2 months ago (2014-10-14 23:07:44 UTC) #11
Bo Xu
I will resolve all the nits in another patch https://codereview.chromium.org/656753002/diff/40001/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp File core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp (right): https://codereview.chromium.org/656753002/diff/40001/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp#newcode244 core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp:244: ...
6 years, 2 months ago (2014-10-14 23:37:49 UTC) #12
Tom Sepez
lgtm
6 years, 2 months ago (2014-10-15 00:05:35 UTC) #13
Bo Xu
Committed patchset #4 (id:60001) manually as e1177425a656f915657f948d965193a019702a52 (presubmit successful).
6 years, 2 months ago (2014-10-15 00:10:16 UTC) #14
Bo Xu
https://codereview.chromium.org/656753002/diff/60001/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp File core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp (right): https://codereview.chromium.org/656753002/diff/60001/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp#newcode219 core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp:219: csData->m_Obj->ReleaseCS(); Hi Tom, I am trying to put them ...
6 years, 2 months ago (2014-10-15 21:31:26 UTC) #15
Tom Sepez
6 years, 2 months ago (2014-10-15 22:05:37 UTC) #16
Message was sent while issue was closed.
https://codereview.chromium.org/656753002/diff/60001/core/src/fpdfapi/fpdf_pa...
File core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp (right):

https://codereview.chromium.org/656753002/diff/60001/core/src/fpdfapi/fpdf_pa...
core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp:219: csData->m_Obj->ReleaseCS();
On 2014/10/15 21:31:26, Bo Xu wrote:
> Hi Tom, I am trying to put them in a member function in fx_basic.h, but the
> colorSpace here uses ReleaseCS instead of delete as others.
> 
> Any suggestion for this? I tried to overload "delete" for CPDF_ColorSpace and
> use ReleaseCS inside, but here does not seem to recognize the overloaded
delete
> though...

As a first step, I think its fine to keep this special case as-is.

Powered by Google App Engine
This is Rietveld 408576698