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

Issue 2393573002: Use FX_SAFE_UINT32 on CPDF_ToUnicodeMap::Load (Closed)

Created:
4 years, 2 months ago by npm
Modified:
4 years, 2 months ago
CC:
pdfium-reviews_googlegroups.com
Target Ref:
refs/heads/master
Project:
pdfium
Visibility:
Public.

Description

Use FX_SAFE_UINT32 on CPDF_ToUnicodeMap::Load m_Map maps to unsigned integer, but m_MultiCharBuf.GetLength() returns an integer. There will be integer overflow if the length is big, and UBSAN will complain. Thus, using FX_SAFE_UINT32. Replacing with uint32 would work as well: the point is to consider the length as uint instead of int. BUG=chromium:652232 Committed: https://pdfium.googlesource.com/pdfium/+/89f9ee3b8f3b4756f05ff48055f4bff7353201e2

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -3 lines) Patch
M core/fpdfapi/fpdf_font/fpdf_font.cpp View 4 chunks +13 lines, -3 lines 5 comments Download

Messages

Total messages: 15 (8 generated)
npm
PTAL
4 years, 2 months ago (2016-10-04 15:47:36 UTC) #5
dsinclair
lgtm https://codereview.chromium.org/2393573002/diff/1/core/fpdfapi/fpdf_font/fpdf_font.cpp File core/fpdfapi/fpdf_font/fpdf_font.cpp (right): https://codereview.chromium.org/2393573002/diff/1/core/fpdfapi/fpdf_font/fpdf_font.cpp#newcode288 core/fpdfapi/fpdf_font/fpdf_font.cpp:288: FX_SAFE_UINT32 uni = m_MultiCharBuf.GetLength(); Followup: These 6 lines ...
4 years, 2 months ago (2016-10-04 17:15:31 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2393573002/1
4 years, 2 months ago (2016-10-04 17:15:40 UTC) #10
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://pdfium.googlesource.com/pdfium/+/89f9ee3b8f3b4756f05ff48055f4bff7353201e2
4 years, 2 months ago (2016-10-04 17:15:58 UTC) #12
Tom Sepez
https://codereview.chromium.org/2393573002/diff/1/core/fpdfapi/fpdf_font/fpdf_font.cpp File core/fpdfapi/fpdf_font/fpdf_font.cpp (right): https://codereview.chromium.org/2393573002/diff/1/core/fpdfapi/fpdf_font/fpdf_font.cpp#newcode232 core/fpdfapi/fpdf_font/fpdf_font.cpp:232: m_MultiCharBuf.AppendChar(destcode.GetLength()); Drive-by: do we prefer skipping/defaulting the value insteadof ...
4 years, 2 months ago (2016-10-04 17:41:21 UTC) #13
npm
https://codereview.chromium.org/2393573002/diff/1/core/fpdfapi/fpdf_font/fpdf_font.cpp File core/fpdfapi/fpdf_font/fpdf_font.cpp (right): https://codereview.chromium.org/2393573002/diff/1/core/fpdfapi/fpdf_font/fpdf_font.cpp#newcode232 core/fpdfapi/fpdf_font/fpdf_font.cpp:232: m_MultiCharBuf.AppendChar(destcode.GetLength()); On 2016/10/04 17:41:21, Tom Sepez wrote: > Drive-by: ...
4 years, 2 months ago (2016-10-04 19:24:17 UTC) #14
dsinclair
4 years, 2 months ago (2016-10-04 19:27:59 UTC) #15
Message was sent while issue was closed.
https://codereview.chromium.org/2393573002/diff/1/core/fpdfapi/fpdf_font/fpdf...
File core/fpdfapi/fpdf_font/fpdf_font.cpp (right):

https://codereview.chromium.org/2393573002/diff/1/core/fpdfapi/fpdf_font/fpdf...
core/fpdfapi/fpdf_font/fpdf_font.cpp:232:
m_MultiCharBuf.AppendChar(destcode.GetLength());
On 2016/10/04 19:24:17, npm wrote:
> On 2016/10/04 17:41:21, Tom Sepez wrote:
> > Drive-by: do we prefer skipping/defaulting the value insteadof crashing
here?
> > 
> > also uni = uni * 0x10000 + 0xffff; might be cleaner.
> 
> I would say we prefer not crashing whenever possible because crashing is the
> worst possible user experience... But not sure, maybe dsinclair@ knows?


Do we know what a sensible default should be? If there is a sensible value we
can return that might be better.

Powered by Google App Engine
This is Rietveld 408576698