New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 821440 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Possible NullPointerException in SelectFileDialog

Reported by pkalinow...@opera.com, Mar 13 2018

Issue description

Steps to reproduce the problem:
I do not have UI reproduction steps, only a bunch of crash reports from Opera for Android installation, showing NullPointerException in ClipData.newUri called from SelectFileDialog.GetCameraIntentTask.onPostExecute (calling Uri.getScheme on a null object reference).

What is the expected behavior?

What went wrong?
SelectFileDialog.GetCameraIntentTask.onPostExecute checks mCameraOutputUri for null only for captureCamera() to abort file selection. But if the file input field does not have a capture attribute, the Uri may still be null when error occurs while creating a temporary capture file, and onPostExecute will then try to create ClipData out of that null Uri, crashing the main thread.

Did this work before? N/A 

Chrome version: 65.0.3325.88  Channel: n/a
OS Version: 
Flash Version: Shockwave Flash 28.0 r0
 
Labels: Needs-triage-Mobile
Cc: sandeepkumars@chromium.org
Labels: Needs-Feedback Triaged-Mobile
Unable to triage this issue since we don't have steps to reproduce the issue.

@pkalinowski: Request you to update Chrome to latest version #65.0.3325.109 and check your issue?

Thanks!!
I have no idea how to trigger file system failure to reproduce it, but the problem is there in the code on master. This is the best report I could come up with to link with the review.
Now that I think about it, perhaps I should have mentioned in the beginning that I am submitting a fix for review to save you some trouble. Sorry about that.
Project Member

Comment 5 by sheriffbot@chromium.org, Mar 14 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Relevant review has been merged. I guess it means this issue can be closed now.
Project Member

Comment 7 by bugdroid1@chromium.org, Mar 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/25512630dbff339fee1dca446c23ffc432da1ebe

commit 25512630dbff339fee1dca446c23ffc432da1ebe
Author: Piotr Kalinowski <pkalinowski@opera.com>
Date: Fri Mar 23 14:42:39 2018

Do not use null Uri for camera intent

In case of failure to create a temporary image capture file,
GetCameraIntentTask#onPostExecute will receive null Uri. For capture
fields, this was already handled by aborting file selection.

However, in remaining cases, it would result in an attempt to add this
null Uri as EXTRA_OUTPUT and to convert it to ClipData. The latter
results in NullPointerException.

This change skips processing null Uri in remaining cases. Camera
intent without an Uri can only return small version of the image
directly as a bitmap, but that is unlikely what user can work with
and the rest of the code is not prepared to handle it anyway.

So, abort if mDirectToCamera == true, as there is no useful intent
to show. Otherwise, proceed with null as a camera intent which
will still enable other modes of file selection. This is also
in line with the behavior before the introduction of
GetCameraIntentTask.

Bug:  821440 
Change-Id: Ib4024c406bbcaf560e5cdde584c317f1ab6477d2
Reviewed-on: https://chromium-review.googlesource.com/960722
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545440}
[modify] https://crrev.com/25512630dbff339fee1dca446c23ffc432da1ebe/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java

Status: Fixed (was: Unconfirmed)
Closing this issue as Fixed from comment #6.

Thanks!!

Sign in to add a comment