Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(582)

Issue 5885055: [PDF] Fix font metric array initialization. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 3 months ago by Steve VanDeBogart
Modified:
12 years, 3 months ago
Reviewers:
epoger, thakis, reed1
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlecode.com/svn/trunk
Visibility:
Public.

Description

[PDF] Fix font metric array initialization. Committed: https://code.google.com/p/skia/source/detail?r=3475

Patch Set 1 #

Patch Set 2 : Address comments #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -2 lines) Patch
M src/pdf/SkPDFDocument.cpp View 1 1 chunk +1 line, -2 lines 2 comments Download

Messages

Total messages: 6
Steve VanDeBogart
12 years, 3 months ago (2012-03-23 03:37:05 UTC) #1
epoger
LGTM
12 years, 3 months ago (2012-03-23 12:59:56 UTC) #2
reed1
optionally, could call sk_bzero(ptr, size). Slightly more clear, and matches a semi-common skia pattern.
12 years, 3 months ago (2012-03-23 13:35:10 UTC) #3
Steve VanDeBogart
On 2012/03/23 13:35:10, reed1 wrote: > optionally, could call sk_bzero(ptr, size). Slightly more clear, and ...
12 years, 3 months ago (2012-03-23 15:17:22 UTC) #4
thakis
https://codereview.appspot.com/5885055/diff/5001/src/pdf/SkPDFDocument.cpp File src/pdf/SkPDFDocument.cpp (right): https://codereview.appspot.com/5885055/diff/5001/src/pdf/SkPDFDocument.cpp#newcode228 src/pdf/SkPDFDocument.cpp:228: sk_bzero(counts, sizeof(counts)); This is actually not correct. The C ...
12 years, 3 months ago (2012-03-26 23:35:23 UTC) #5
Steve VanDeBogart
12 years, 3 months ago (2012-03-26 23:41:27 UTC) #6
https://codereview.appspot.com/5885055/diff/5001/src/pdf/SkPDFDocument.cpp
File src/pdf/SkPDFDocument.cpp (right):

https://codereview.appspot.com/5885055/diff/5001/src/pdf/SkPDFDocument.cpp#ne...
src/pdf/SkPDFDocument.cpp:228: sk_bzero(counts, sizeof(counts));
On 2012/03/26 23:35:24, thakis wrote:
> This is actually not correct. The C spec says that sizeof an array that's
passed
> as a function parameter is just the size of a pointer (see e.g.
> http://stackoverflow.com/questions/1328223/sizeof-array-passed-as-parameter ),
> so this will only zero out the first 4 bytes.
> 
> Since this is so surprising, I added a warning to clang that calls this out:
> 
> 
> ../../third_party/skia/src/pdf/SkPDFDocument.cpp:228:28: warning: sizeof on
> array function parameter will return size of 'int *' instead of 'int [6]'
> [-Wsizeof-array-argument]
>     sk_bzero(counts, sizeof(counts));
>                            ^
> ../../third_party/skia/src/pdf/SkPDFDocument.cpp:227:13: note: declared here
>         int counts[SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1]) const
{
>             ^
> 1 warning generated.
> 
> 
> Can you take a look?

In fact I worked around the initial bug on the Chrome side to make it easier to
roll Skia.  Skia has now rolled passed this revision so I dispatched a change to
clean up the Chrome side which failed on the bots.  I suspected that the problem
might be what you describ and I was about to attach my debugger to confirm that.

I'll dispatch a change to go back to a (correct version) of what it was before.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b