diff options
author | Michael W <baddaemon87@gmail.com> | 2016-05-30 22:50:45 +0200 |
---|---|---|
committer | Michael W <baddaemon87@gmail.com> | 2016-05-30 22:50:45 +0200 |
commit | aa238e9fd6c24f279eef6265f50636eb1eef1ece (patch) | |
tree | e14fcd524284986794c735f38bc6f671d9a0defd /core | |
parent | 1c1efe46d095646111db415983005a96b8bee244 (diff) | |
download | frameworks_base-aa238e9fd6c24f279eef6265f50636eb1eef1ece.zip frameworks_base-aa238e9fd6c24f279eef6265f50636eb1eef1ece.tar.gz frameworks_base-aa238e9fd6c24f279eef6265f50636eb1eef1ece.tar.bz2 |
Core: Fix OOB
getExternal___Dir() relies on getExternal___Dirs to return an array
of at least 1 element.
Make sure there is at least one element returned.
(Reference:
BugDump 13-20160513-19 l#45 (FileManager) and L#104 (Gallery)
BugDump 13-20160520-26 L#18 and more (26), just search for
"getExternal" to find all cases of that OOB (>>100 users))
Change-Id: I56394db135c4c53c972e3bcc8f1df4ea1d4d39e7
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/ContextImpl.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index d443d80..6896c21 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -2018,6 +2018,11 @@ class ContextImpl extends Context { } result.add(dir); } + + // Make sure there is at least one element, let the callers handle that + if (result.size() == 0) { + result.add(null); + } return result.toArray(new File[result.size()]); } |