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

Issue 11728004: Fix use after free in JavascriptAppModalDialogAndroid. (Closed)

Created:
7 years, 11 months ago by Philippe
Modified:
7 years, 11 months ago
Reviewers:
Yaron, nilesh, Jay Civelli
CC:
chromium-reviews, aurimas (slooooooooow), pasko-google - do not use
Visibility:
Public.

Description

Fix use after free in JavascriptAppModalDialogAndroid. On Android JavascriptAppModalDialog is implemented with a Java class and its native counterpart. The Java class holds a pointer to the native instance. When UI events (e.g. button click) are processed, the Java side calls a native method (e.g. JavascriptAppModalDialog::DidAcceptAppModalDialog()). When this native method completes the instance deletes itself. This is only correct in case it is guaranteed that no further native method call is performed by the Java side since the pointer was freed. The problem is that this can happen in some rare circumstances. For instance the user could manage to click on two buttons before the dialog is closed which might happen if the first click event is not processed immediately or takes a long time to be processed. This CL fixes the crash by invalidating the native pointer on the Java side when it is deleted so that the Java side can perform a native method call only if the native instance pointer is still valid. BUG=167585 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=175139

Patch Set 1 : #

Patch Set 2 : #

Patch Set 3 : Add missing 'virtual' (only needed by the Chromium style Clang plugin) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -12 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java View 2 chunks +7 lines, -2 lines 0 comments Download
M chrome/browser/ui/android/javascript_app_modal_dialog_android.h View 2 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/ui/android/javascript_app_modal_dialog_android.cc View 2 chunks +9 lines, -9 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Philippe
7 years, 11 months ago (2013-01-02 13:23:20 UTC) #1
Jay Civelli
lgtm
7 years, 11 months ago (2013-01-02 16:55:33 UTC) #2
Philippe
On 2013/01/02 16:55:33, Jay Civelli wrote: > lgtm Thanks Jay. I'm waiting for Yaron for ...
7 years, 11 months ago (2013-01-02 16:57:58 UTC) #3
Philippe
On 2013/01/02 16:57:58, Philippe wrote: > On 2013/01/02 16:55:33, Jay Civelli wrote: > > lgtm ...
7 years, 11 months ago (2013-01-03 09:18:24 UTC) #4
nilesh
LGTM
7 years, 11 months ago (2013-01-03 17:20:55 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pliard@chromium.org/11728004/5001
7 years, 11 months ago (2013-01-03 18:06:56 UTC) #6
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 11 months ago (2013-01-03 18:34:12 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pliard@chromium.org/11728004/17001
7 years, 11 months ago (2013-01-04 09:35:31 UTC) #8
commit-bot: I haz the power
7 years, 11 months ago (2013-01-04 12:30:44 UTC) #9
Retried try job too often on mac_rel for step(s) browser_tests

Powered by Google App Engine
This is Rietveld 408576698