Loading libs/androidfw/ApkParsing.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -56,10 +56,8 @@ const char* ValidLibraryPathLastSlash(const char* fileName, bool suppress64Bit, return nullptr; } // Make sure there aren't subdirectories const char* abiOffset = fileName + APK_LIB_LEN; const size_t abiSize = lastSlash - abiOffset; if (memchr(abiOffset, '/', abiSize)) { // Make sure there aren't subdirectories by checking if the next / after lib/ is the last slash if (memchr(fileName + APK_LIB_LEN, '/', fileNameLen - APK_LIB_LEN) != lastSlash) { return nullptr; } Loading libs/androidfw/tests/ApkParsing_test.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -68,4 +68,10 @@ TEST(ApkParsingTest, InvalidSubdirectories) { auto lastSlash = util::ValidLibraryPathLastSlash(path, false, false); ASSERT_THAT(lastSlash, IsNull()); } TEST(ApkParsingTest, InvalidFileAtRoot) { const char* path = "lib/library.so"; auto lastSlash = util::ValidLibraryPathLastSlash(path, false, false); ASSERT_THAT(lastSlash, IsNull()); } } No newline at end of file Loading
libs/androidfw/ApkParsing.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -56,10 +56,8 @@ const char* ValidLibraryPathLastSlash(const char* fileName, bool suppress64Bit, return nullptr; } // Make sure there aren't subdirectories const char* abiOffset = fileName + APK_LIB_LEN; const size_t abiSize = lastSlash - abiOffset; if (memchr(abiOffset, '/', abiSize)) { // Make sure there aren't subdirectories by checking if the next / after lib/ is the last slash if (memchr(fileName + APK_LIB_LEN, '/', fileNameLen - APK_LIB_LEN) != lastSlash) { return nullptr; } Loading
libs/androidfw/tests/ApkParsing_test.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -68,4 +68,10 @@ TEST(ApkParsingTest, InvalidSubdirectories) { auto lastSlash = util::ValidLibraryPathLastSlash(path, false, false); ASSERT_THAT(lastSlash, IsNull()); } TEST(ApkParsingTest, InvalidFileAtRoot) { const char* path = "lib/library.so"; auto lastSlash = util::ValidLibraryPathLastSlash(path, false, false); ASSERT_THAT(lastSlash, IsNull()); } } No newline at end of file