diff options
author | Alex Light <allight@google.com> | 2019-01-02 15:25:22 -0800 |
---|---|---|
committer | Alex Light <allight@google.com> | 2019-01-02 15:30:50 -0800 |
commit | ecb95b8a15d3d49fe55614b0ffdd044a60e8d48e (patch) | |
tree | a6d6049c5585f5d7fc4f3d87130a06c1bcae36ab /libc | |
parent | 7bd54ade8d12762ef6bdb0096f3838261f14eee5 (diff) |
Check return value of scandir in icu.cpp
We could cause illegal memory access due to not checking the scanddir
return value.
Test: run linux-bionic dex2oat to build boot.oat
Bug: 119332362
Change-Id: Ic5824e0373b9b99d8f892b4fcf22e742c6f792da
Diffstat (limited to 'libc')
-rw-r--r-- | libc/bionic/icu.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/bionic/icu.cpp b/libc/bionic/icu.cpp index c09c9eac1..7c44f9791 100644 --- a/libc/bionic/icu.cpp +++ b/libc/bionic/icu.cpp @@ -59,6 +59,10 @@ static int __icu_dat_file_filter(const dirent* dirp) { static bool __find_icu() { dirent** namelist = nullptr; int n = scandir("/system/usr/icu", &namelist, &__icu_dat_file_filter, alphasort); + if (n < 0) { + async_safe_write_log(ANDROID_LOG_ERROR, "bionic-icu", "couldn't find ICU folder"); + return false; + } int max_version = -1; while (n--) { // We prefer the latest version available. |