Fix checking for subdirs when parsing apks
This fixes the check for subdirectories in lib paths. The old check
caused a crash.
Test: Automated
Fixes: 268582810
Change-Id: I520f1fd6772b11821e7c5c97bd51b45b603f5a7b
diff --git a/libs/androidfw/tests/ApkParsing_test.cpp b/libs/androidfw/tests/ApkParsing_test.cpp
index 4aab0a1..62e88c6 100644
--- a/libs/androidfw/tests/ApkParsing_test.cpp
+++ b/libs/androidfw/tests/ApkParsing_test.cpp
@@ -68,4 +68,10 @@
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