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

Issue 4529074: Fix uninitialized memory in Sk2DPathEffect (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 5 months ago by Stephen White
Modified:
13 years, 5 months ago
Reviewers:
reed, bsalomon, reed1
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

The SkDescriptor checksum calculation for Sk2DPathEffect currently evaluates all the bytes in the embedded SkMatrix. This includes the type mask, which contains some uninitialized padding. Changing it to use SkMatrix::flatten() and SkMatrix::unflatten() (as SkGroupShape was doing) avoids the uninitialized data errors. To test, run SampleApp under valgrind and look for the absence of: ==5490== Conditional jump or move depends on uninitialised value(s) ==5490== at 0x402ABC9: bcmp (mc_replace_strmem.c:567) ==5490== by 0x47C55C: SkPaint::descriptorProc(SkMatrix const*, void (*)(SkDescriptor const*, void*), void*, bool) const (SkPaint.cpp:1440) ==5490== by 0x47C73B: SkPaint::detachCache(SkMatrix const*) const (SkPaint.cpp:1450) ==5490== by 0x4662A0: SkAutoGlyphCache::SkAutoGlyphCache(SkPaint const&, SkMatrix const*) (SkGlyphCache.h:287) ==5490== by 0x4628C7: SkDraw::drawText(char const*, unsigned long, float, float, SkPaint const&) const (SkDraw.cpp:1584) ==5490== by 0x45D2C1: SkDevice::drawText(SkDraw const&, void const*, unsigned long, float, float, SkPaint const&) (SkDevice.cpp:197) ==5490== by 0x451CA6: SkCanvas::drawText(void const*, unsigned long, float, float, SkPaint const&) (SkCanvas.cpp:1393) ==5490== by 0x40DB6F: ClockFaceView::onDraw(SkCanvas*) (ClockFaceView.cpp:230)

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -2 lines) Patch
src/effects/Sk2DPathEffect.cpp View 1 chunk +8 lines, -2 lines 1 comment Download

Messages

Total messages: 4
Stephen White
13 years, 5 months ago (2011-05-20 15:36:54 UTC) #1
reed1
I had just made a similar fix in the pipe code. Good catch. LGTM
13 years, 5 months ago (2011-05-20 18:58:39 UTC) #2
reed1
http://codereview.appspot.com/4529074/diff/1/src/effects/Sk2DPathEffect.cpp File src/effects/Sk2DPathEffect.cpp (right): http://codereview.appspot.com/4529074/diff/1/src/effects/Sk2DPathEffect.cpp#newcode94 src/effects/Sk2DPathEffect.cpp:94: uint32_t size = buffer.readS32(); maybe add this? SkASSERT(size <= ...
13 years, 5 months ago (2011-05-20 18:59:46 UTC) #3
Stephen White
13 years, 5 months ago (2011-05-20 19:19:23 UTC) #4
On 2011/05/20 18:59:46, reed1 wrote:
> http://codereview.appspot.com/4529074/diff/1/src/effects/Sk2DPathEffect.cpp
> File src/effects/Sk2DPathEffect.cpp (right):
> 
>
http://codereview.appspot.com/4529074/diff/1/src/effects/Sk2DPathEffect.cpp#n...
> src/effects/Sk2DPathEffect.cpp:94: uint32_t size = buffer.readS32();
> maybe add this?
> 
> SkASSERT(size <= sizeof(storage));

Done.  Landed as r1395.  Closing.
Sign in to reply to this message.

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