disable ubsan (integer_overflow)
Due to the bug in the current stringstream, CodeWriter fails to write
non-ascii characters when ubsan is on.
Bug: 174366536
Test: aidl_unittests
Test: aidlcpp system/iorap/binder/com/google/android/startop/iorap/IIorap.aidl
Change-Id: I7f9ceb69b0652f56ccfcb19fa0f24c5ceed49b65
diff --git a/code_writer_unittest.cpp b/code_writer_unittest.cpp
index 9cf462c..76a2af5 100644
--- a/code_writer_unittest.cpp
+++ b/code_writer_unittest.cpp
@@ -44,5 +44,17 @@
EXPECT_EQ(str, "Write this and that");
}
+TEST(CodeWriterTest, WorksWithNonAscii) {
+ // Due to b/174366536(basic_stringbuf implicit-conversion), the following snippet crashes
+ // std::stringstream s;
+ // s << "가";
+ std::string str;
+ CodeWriterPtr ptr = CodeWriter::ForString(&str);
+ CodeWriter& writer = *ptr;
+ writer << "가";
+ writer.Close();
+ EXPECT_EQ(str, "가");
+}
+
} // namespace aidl
} // namespace android