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

Issue 1800263002: Fix pointer aliasing bug in SkImageFilter::computeFastBounds. (Closed)

Created:
4 years, 9 months ago by jbroman
Modified:
4 years, 9 months ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Fix pointer aliasing bug in SkImageFilter::computeFastBounds. Since src and dst are explicitly allowed to alias (according to a comment in SkPaint.h), it is problematic to have the first input filter mutate dst, since we still need access to the previous value to provide to the other input filters. To resolve this, SkImageFilter::computeFastBounds makes a copy of src on the stack, and passes that to its inputs instead. Also add a unit test that would have detected the issue. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1800263002 Committed: https://skia.googlesource.com/skia/+/0e3129d734212089f872f0e7de8f2537861a3f89

Patch Set 1 #

Total comments: 2

Patch Set 2 : copy dst rather than src #

Total comments: 6

Patch Set 3 : code review comments on unit test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+29 lines, -4 lines) Patch
M src/core/SkImageFilter.cpp View 1 1 chunk +7 lines, -4 lines 0 comments Download
M tests/ImageFilterTest.cpp View 1 2 1 chunk +22 lines, -0 lines 0 comments Download

Messages

Total messages: 29 (11 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1800263002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1800263002/1
4 years, 9 months ago (2016-03-15 19:39:55 UTC) #3
commit-bot: I haz the power
Note for Reviewers: The CQ is waiting for an approval. If you believe that the ...
4 years, 9 months ago (2016-03-15 19:39:56 UTC) #4
jbroman
Ran into this bug while working in Blink. Fix seems straightforward; PTAL!
4 years, 9 months ago (2016-03-15 19:41:43 UTC) #7
Stephen White
https://codereview.chromium.org/1800263002/diff/1/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/1800263002/diff/1/src/core/SkImageFilter.cpp#newcode317 src/core/SkImageFilter.cpp:317: const SkRect srcCopy = src; For clarity, let's just ...
4 years, 9 months ago (2016-03-15 20:39:23 UTC) #8
Stephen White
Let me try that again. SkRect result; if (this->getInput(0)) { this->getInput(0)->computeFastBounds(src, &result); } else { ...
4 years, 9 months ago (2016-03-15 20:40:56 UTC) #9
jbroman
https://codereview.chromium.org/1800263002/diff/1/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/1800263002/diff/1/src/core/SkImageFilter.cpp#newcode317 src/core/SkImageFilter.cpp:317: const SkRect srcCopy = src; On 2016/03/15 at 20:39:23, ...
4 years, 9 months ago (2016-03-15 23:41:23 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1800263002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1800263002/20001
4 years, 9 months ago (2016-03-15 23:41:29 UTC) #12
commit-bot: I haz the power
Dry run: No LGTM from a valid reviewer yet. Please ask for an LGTM from ...
4 years, 9 months ago (2016-03-16 01:39:10 UTC) #14
reed1
4 years, 9 months ago (2016-03-16 13:46:32 UTC) #16
reed1
Perhaps we can consider returning the result. That eliminates any confusion/complication around aliasing.
4 years, 9 months ago (2016-03-16 13:47:29 UTC) #18
robertphillips
I second Mike's interest in making it structurally more difficult to mess up. That should ...
4 years, 9 months ago (2016-03-16 13:54:53 UTC) #19
robertphillips
lgtm
4 years, 9 months ago (2016-03-16 13:56:09 UTC) #20
jbroman
FWIW, I'd have also preferred the signature SkRect(const SkRect&), but that seemed like a separate ...
4 years, 9 months ago (2016-03-16 14:51:37 UTC) #21
Stephen White
LGTM
4 years, 9 months ago (2016-03-16 17:16:48 UTC) #22
jbroman
ping reed for OWNERS?
4 years, 9 months ago (2016-03-17 18:15:31 UTC) #23
reed1
No needed for owners, but happy to review. lgtm https://bugs.chromium.org/p/skia/issues/detail?id=5094
4 years, 9 months ago (2016-03-17 19:04:18 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1800263002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1800263002/40001
4 years, 9 months ago (2016-03-17 19:11:49 UTC) #27
commit-bot: I haz the power
4 years, 9 months ago (2016-03-17 19:24:29 UTC) #29
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://skia.googlesource.com/skia/+/0e3129d734212089f872f0e7de8f2537861a3f89

Powered by Google App Engine
This is Rietveld 408576698