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

Issue 1273183002: Fix invalid C-style cast in RenderFrameImplTest. (Closed)

Created:
5 years, 4 months ago by krasin
Modified:
5 years, 4 months ago
Reviewers:
nasko
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, creis+watch_chromium.org, nasko+codewatch_chromium.org, jam, darin-cc_chromium.org, mkwst+moarreviews-renderer_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix invalid C-style cast in RenderFrameImplTest. It casts (like reinterpret_cast) from one unrelated type (content::RenderView*) to another unrelated type (content::RenderWidget*). The result pointer is invalid, but it's only used in EXPECT_NE, which would always be satisfied. Using the correct static cast instead. The bug was found by Control Flow Integrity check: https://sites.google.com/a/chromium.org/dev/developers/testing/control-flow-integrity BUG=chromium:457523, chromium:517544 Committed: https://crrev.com/25646da121a85f51e54f52c161172d7e5c614aea Cr-Commit-Position: refs/heads/master@{#342222}

Patch Set 1 #

Total comments: 1

Patch Set 2 : two casts; comments #

Total comments: 6

Patch Set 3 : nits #

Total comments: 1

Patch Set 4 : remove two more content:: #

Unified diffs Side-by-side diffs Delta from patch set Stats (+14 lines, -1 line) Patch
M content/renderer/render_frame_impl_browsertest.cc View 1 2 3 1 chunk +14 lines, -1 line 0 comments Download

Messages

Total messages: 24 (6 generated)
krasin
5 years, 4 months ago (2015-08-06 17:54:05 UTC) #2
nasko
https://codereview.chromium.org/1273183002/diff/1/content/renderer/render_frame_impl_browsertest.cc File content/renderer/render_frame_impl_browsertest.cc (right): https://codereview.chromium.org/1273183002/diff/1/content/renderer/render_frame_impl_browsertest.cc#newcode114 content/renderer/render_frame_impl_browsertest.cc:114: static_cast<content::RenderViewImpl*>((view_))); This is not a correct cast. The subframe ...
5 years, 4 months ago (2015-08-06 18:08:33 UTC) #3
krasin
On 2015/08/06 18:08:33, nasko wrote: > https://codereview.chromium.org/1273183002/diff/1/content/renderer/render_frame_impl_browsertest.cc > File content/renderer/render_frame_impl_browsertest.cc (right): > > https://codereview.chromium.org/1273183002/diff/1/content/renderer/render_frame_impl_browsertest.cc#newcode114 > ...
5 years, 4 months ago (2015-08-06 18:42:39 UTC) #4
nasko
On 2015/08/06 18:42:39, krasin wrote: > On 2015/08/06 18:08:33, nasko wrote: > > > https://codereview.chromium.org/1273183002/diff/1/content/renderer/render_frame_impl_browsertest.cc ...
5 years, 4 months ago (2015-08-06 19:05:50 UTC) #5
krasin
> If you look at the inheritance, RenderViewImpl is also RenderWidget, as it > inherits ...
5 years, 4 months ago (2015-08-06 19:35:29 UTC) #6
krasin
> As for comparing the same types, will the following work? > > static_cast<RenderWidget*>(static_cast<RenderViewImpl*>(view_)) By ...
5 years, 4 months ago (2015-08-06 19:36:55 UTC) #7
nasko
On 2015/08/06 19:36:55, krasin wrote: > > As for comparing the same types, will the ...
5 years, 4 months ago (2015-08-06 20:14:21 UTC) #8
krasin
On 2015/08/06 20:14:21, nasko wrote: > On 2015/08/06 19:36:55, krasin wrote: > > > As ...
5 years, 4 months ago (2015-08-06 20:15:33 UTC) #9
krasin
I have added the comments, and the second cast to RenderWidget*. Please, take another look!
5 years, 4 months ago (2015-08-06 20:26:56 UTC) #10
nasko
LGTM with nits. https://codereview.chromium.org/1273183002/diff/20001/content/renderer/render_frame_impl_browsertest.cc File content/renderer/render_frame_impl_browsertest.cc (right): https://codereview.chromium.org/1273183002/diff/20001/content/renderer/render_frame_impl_browsertest.cc#newcode114 content/renderer/render_frame_impl_browsertest.cc:114: // because it and content::RenderView are ...
5 years, 4 months ago (2015-08-06 20:55:21 UTC) #11
krasin
https://codereview.chromium.org/1273183002/diff/20001/content/renderer/render_frame_impl_browsertest.cc File content/renderer/render_frame_impl_browsertest.cc (right): https://codereview.chromium.org/1273183002/diff/20001/content/renderer/render_frame_impl_browsertest.cc#newcode114 content/renderer/render_frame_impl_browsertest.cc:114: // because it and content::RenderView are two unrelated base ...
5 years, 4 months ago (2015-08-06 21:02:22 UTC) #12
krasin
Thank you for the review and sorry for a little bit of confusion in the ...
5 years, 4 months ago (2015-08-06 21:03:10 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1273183002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1273183002/40001
5 years, 4 months ago (2015-08-06 21:04:10 UTC) #16
nasko
https://codereview.chromium.org/1273183002/diff/40001/content/renderer/render_frame_impl_browsertest.cc File content/renderer/render_frame_impl_browsertest.cc (right): https://codereview.chromium.org/1273183002/diff/40001/content/renderer/render_frame_impl_browsertest.cc#newcode114 content/renderer/render_frame_impl_browsertest.cc:114: // it and content::RenderView are two unrelated base classes ...
5 years, 4 months ago (2015-08-06 21:05:30 UTC) #18
krasin
On 2015/08/06 21:05:30, nasko wrote: > https://codereview.chromium.org/1273183002/diff/40001/content/renderer/render_frame_impl_browsertest.cc > File content/renderer/render_frame_impl_browsertest.cc (right): > > https://codereview.chromium.org/1273183002/diff/40001/content/renderer/render_frame_impl_browsertest.cc#newcode114 > ...
5 years, 4 months ago (2015-08-06 21:10:50 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1273183002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1273183002/60001
5 years, 4 months ago (2015-08-06 21:19:07 UTC) #22
commit-bot: I haz the power
Committed patchset #4 (id:60001)
5 years, 4 months ago (2015-08-06 22:58:48 UTC) #23
commit-bot: I haz the power
5 years, 4 months ago (2015-08-06 22:59:38 UTC) #24
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/25646da121a85f51e54f52c161172d7e5c614aea
Cr-Commit-Position: refs/heads/master@{#342222}

Powered by Google App Engine
This is Rietveld 408576698