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

Issue 7061059: Ensure that SkMemoryStream does not crash dereferencing fData. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 10 months ago by Leon
Modified:
11 years, 10 months ago
Reviewers:
Humper, reed1
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlecode.com/svn/trunk
Visibility:
Public.

Description

Ensure that SkMemoryStream does not crash dereferencing fData. SkMemoryStream attempts to dereference fData in multiple places. Instead of allowing it to be NULL, resulting in a crash, set it to SkData::NewEmpty(). Add a test for SkStream that will crash when its SkData is set to NULL. Committed: https://code.google.com/p/skia/source/detail?r=7111

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -5 lines) Patch
M include/core/SkStream.h View 1 chunk +7 lines, -1 line 0 comments Download
M src/core/SkStream.cpp View 2 chunks +14 lines, -4 lines 0 comments Download
M tests/StreamTest.cpp View 1 chunk +19 lines, -0 lines 0 comments Download

Messages

Total messages: 3
Leon
Sorry to step on your just added code, Greg, but we actually had a bug ...
11 years, 10 months ago (2013-01-09 21:42:28 UTC) #1
Humper
On 2013/01/09 21:42:28, scroggo-work wrote: > Sorry to step on your just added code, Greg, ...
11 years, 10 months ago (2013-01-09 21:44:51 UTC) #2
reed1
11 years, 10 months ago (2013-01-09 21:48:34 UTC) #3
lgtm

I think earlier I wanted to avoid creating the emptydata, and then call setData.
This if/else does that.

Also, we clearly had a bug all along in setData, where we didn't check for null.

I guess we need an implementation comment that asserts that fData (the private
field) is *never* null.
Sign in to reply to this message.

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