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

Issue 528163002: Allocate m_pCompData when |m_nComponents| is updated. (Closed)

Created:
6 years, 3 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

Allocate m_pCompData when |m_nComponents| is updated. When |m_nComponents| is changed from loading stream information, previously allocated memory that depends on |m_nComponents| needes to be freed and allocated again to enforce memory size consistency. BUG=409695 R=tsepez@chromium.org Committed: https://pdfium.googlesource.com/pdfium/+/bb3c1a29348511afdc140cccdf5b1f5d0292794c

Patch Set 1 #

Patch Set 2 : re-format #

Total comments: 1

Patch Set 3 : Move AllocCompData into LoadColorInfo #

Total comments: 10

Patch Set 4 : GetDecodeAndMaskarray #

Total comments: 8

Patch Set 5 : check return value #

Total comments: 4

Patch Set 6 : Fix typo #

Unified diffs Side-by-side diffs Delta from patch set Stats (+38 lines, -23 lines) Patch
M core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp View 1 2 3 4 5 3 chunks +37 lines, -23 lines 0 comments Download
M core/src/fpdfapi/fpdf_render/render_int.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 12 (1 generated)
Bo Xu
Hi Tom, please review this one, thanks.
6 years, 3 months ago (2014-09-03 00:23:46 UTC) #2
jun_fang
https://codereview.chromium.org/528163002/diff/20001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp File core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp (right): https://codereview.chromium.org/528163002/diff/20001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode185 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:185: AllocCompData(); m_pCompData = GetCompData(); if (!m_pCompData) { return; } ...
6 years, 3 months ago (2014-09-03 04:17:08 UTC) #3
Tom Sepez
https://codereview.chromium.org/528163002/diff/40001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp File core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp (right): https://codereview.chromium.org/528163002/diff/40001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode502 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:502: void CPDF_DIBSource::AllocCompData() nit: maybe AllocCompDataAndDecode(). https://codereview.chromium.org/528163002/diff/40001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode502 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:502: void CPDF_DIBSource::AllocCompData() ...
6 years, 3 months ago (2014-09-03 16:59:11 UTC) #4
Bo Xu
https://codereview.chromium.org/528163002/diff/40001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp File core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp (right): https://codereview.chromium.org/528163002/diff/40001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode502 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:502: void CPDF_DIBSource::AllocCompData() On 2014/09/03 16:59:11, Tom Sepez wrote: > ...
6 years, 3 months ago (2014-09-03 18:10:16 UTC) #5
jun_fang
https://codereview.chromium.org/528163002/diff/60001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp File core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp (right): https://codereview.chromium.org/528163002/diff/60001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode499 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:499: m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey); check |m_pCompData == NULL|? https://codereview.chromium.org/528163002/diff/60001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode502 ...
6 years, 3 months ago (2014-09-03 19:12:02 UTC) #6
Tom Sepez
https://codereview.chromium.org/528163002/diff/60001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp File core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp (right): https://codereview.chromium.org/528163002/diff/60001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode582 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:582: FX_Free(m_pCompData); nit: I'd do the free before the assign ...
6 years, 3 months ago (2014-09-03 19:22:51 UTC) #7
Bo Xu
https://codereview.chromium.org/528163002/diff/60001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp File core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp (right): https://codereview.chromium.org/528163002/diff/60001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode499 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:499: m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey); On 2014/09/03 19:12:02, jun_fang wrote: ...
6 years, 3 months ago (2014-09-03 19:36:59 UTC) #8
Tom Sepez
lgtm
6 years, 3 months ago (2014-09-03 19:38:59 UTC) #9
jun_fang
https://codereview.chromium.org/528163002/diff/80001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp File core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp (right): https://codereview.chromium.org/528163002/diff/80001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode524 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:524: DefaultDecode = FALSE; bDefaultDecode? https://codereview.chromium.org/528163002/diff/80001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode552 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:552: ColorKey = TRUE; ...
6 years, 3 months ago (2014-09-03 19:42:17 UTC) #10
Bo Xu
https://codereview.chromium.org/528163002/diff/80001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp File core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp (right): https://codereview.chromium.org/528163002/diff/80001/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp#newcode524 core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp:524: DefaultDecode = FALSE; On 2014/09/03 19:42:17, jun_fang wrote: > ...
6 years, 3 months ago (2014-09-03 20:12:24 UTC) #11
Bo Xu
6 years, 3 months ago (2014-09-03 20:30:42 UTC) #12
Message was sent while issue was closed.
Committed patchset #6 (id:100001) manually as bb3c1a2 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698