[Static Analysis] Errors in gecko/GeckoAppShell.java

RESOLVED FIXED in Firefox 63

Status

()

P3
normal
RESOLVED FIXED
5 months ago
5 months ago

People

(Reporter: rbartlensky, Assigned: rbartlensky)

Tracking

(Blocks: 1 bug)

unspecified
Firefox 63
Unspecified
Android
Points:
---

Firefox Tracking Flags

(firefox-esr52 wontfix, firefox-esr60 wontfix, firefox61 wontfix, firefox62 wontfix, firefox63 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 months ago
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java:1359: error: NULL_DEREFERENCE
  object returned by `get(getApplicationContext()).getDir()` could be null and is dereferenced at line 1359.
  1357.           BufferedReader in = null;
  1358.           try {
  1359. >             String filter = GeckoProfile.get(getApplicationContext()).getDir().toString();
  1360.               Log.d(LOGTAG, "[OPENFILE] Filter: " + filter);
  1361.   

mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java:1714: error: NULL_DEREFERENCE
  object `lock` last assigned on line 1713 could be null and is dereferenced at line 1714.
  1712.           if (profile != null) {
  1713.               File lock = profile.getFile(".parentlock");
  1714. >             return lock.exists() && lock.delete();
  1715.           }
  1716.           return false;

mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java:1777: error: RESOURCE_LEAK
  resource of type `java.io.PipedOutputStream` acquired by call to `PipedOutputStream()` at line 1774 is not released after line 1777.
  1775.                   connect(output);
  1776.   
  1777. >                 ThreadUtils.postToBackgroundThread(
  1778.                       new Runnable() {
  1779.                           @Override

mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java:1789: error: RESOURCE_LEAK
  resource of type `java.io.PipedOutputStream` acquired to `output` by call to `PipedOutputStream()` at line 1774 is not released after line 1789.
**Note**: potential exception at line 1775
  1787.                       });
  1788.                   mHaveConnected = true;
  1789. >                 return super.read(buffer, byteOffset, byteCount);
  1790.               }
  1791.           }

mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java:289: error: NULL_DEREFERENCE
  object returned by `getRootException(e)` could be null and is dereferenced by call to `getExceptionStackTrace(...)` at line 289.
  287.       @WrapForJNI(exceptionMode = "ignore")
  288.       private static String getExceptionStackTrace(Throwable e) {
  289. >         return CrashHandler.getExceptionStackTrace(CrashHandler.getRootException(e));
  290.       }
  291.
Comment hidden (mozreview-request)

Comment 2

5 months ago
mozreview-review
Comment on attachment 8991570 [details]
Bug 1474973: Fix NULL_DEREFERENCE errors.

https://reviewboard.mozilla.org/r/256494/#review263530

Hmm, okay.  It's not clear to me that it's better to fail to unlock the profile than crash in this situation, but there must be a race to get the lock file, which is bad in itself.

Bombs away.
Attachment #8991570 - Flags: review?(nalexander) → review+
(Assignee)

Updated

5 months ago
Blocks: 1175203
(Assignee)

Updated

5 months ago
Keywords: checkin-needed

Comment 3

5 months ago
Pushed by nerli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b3e82720e36c
Fix NULL_DEREFERENCE errors. r=nalexander
Keywords: checkin-needed

Comment 4

5 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/b3e82720e36c
Status: NEW → RESOLVED
Last Resolved: 5 months ago
status-firefox63: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
I'm setting status-firefox62=wontfix because a user with a locked profile will be having a bad time with or without this fix. :( If you think this problem is more serious, please feel free to change status-firefox62 and request beta uplift.
status-firefox61: --- → wontfix
status-firefox62: --- → wontfix
status-firefox-esr52: --- → wontfix
status-firefox-esr60: --- → wontfix
OS: Unspecified → Android
You need to log in before you can comment on or make changes to this bug.