From b9f0548341f98a64a87fa35ef5f58d1daf973ca7 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Fri, 2 Jun 2017 16:32:37 -0700 Subject: AAPT2: Do not interpret %n as a format specifier in string resources %n is a special value marking a platform independent newline and is not to be considered a format argument. Bug: 37132275 Test: make aapt2_tests Change-Id: I806521e44afe20004344dee9f18ecee6cc7086ea --- tools/aapt2/ResourceParser_test.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools/aapt2/ResourceParser_test.cpp') diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp index 5352ca8679b3..c6382b177f42 100644 --- a/tools/aapt2/ResourceParser_test.cpp +++ b/tools/aapt2/ResourceParser_test.cpp @@ -843,4 +843,9 @@ TEST_F(ResourceParserTest, ParseElementWithNoValue) { EXPECT_THAT(*str->value, Eq("")); } +TEST_F(ResourceParserTest, ParsePlatformIndependentNewline) { + std::string input = R"(%1$s %n %2$s)"; + ASSERT_TRUE(TestParse(input)); +} + } // namespace aapt -- cgit v1.2.3