Closed Bug 1474973 Opened 6 years ago Closed 6 years ago

[Static Analysis] Errors in gecko/GeckoAppShell.java

Categories

(GeckoView :: General, defect, P3)

Unspecified
Android
defect

Tracking

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

RESOLVED FIXED
mozilla63
Tracking Status
firefox-esr52 --- wontfix
firefox-esr60 --- wontfix
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- fixed

People

(Reporter: rbartlensky, Assigned: rbartlensky)

References

Details

Attachments

(1 file)

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 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+
Blocks: infer
Keywords: checkin-needed
Pushed by nerli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b3e82720e36c
Fix NULL_DEREFERENCE errors. r=nalexander
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/b3e82720e36c
Status: NEW → RESOLVED
Closed: 6 years ago
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.
OS: Unspecified → Android
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 63 → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: