Skip to content

Instantly share code, notes, and snippets.

@tpboudreau
Created June 15, 2019 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpboudreau/b6610c13cbfede4d6b171da681d1f94e to your computer and use it in GitHub Desktop.
Save tpboudreau/b6610c13cbfede4d6b171da681d1f94e to your computer and use it in GitHub Desktop.
Reproduce UB using existing unit test
diff --git a/cpp/src/parquet/arrow/arrow-reader-writer-test.cc b/cpp/src/parquet/arrow/arrow-reader-writer-test.cc
index 21f6f04..8238f5c 100644
--- a/cpp/src/parquet/arrow/arrow-reader-writer-test.cc
+++ b/cpp/src/parquet/arrow/arrow-reader-writer-test.cc
@@ -1256,20 +1265,47 @@ TEST(TestArrowReadWrite, UseDeprecatedInt96) {
using ::arrow::field;
using ::arrow::schema;
- std::vector<bool> is_valid = {true, true, true, false, true, true};
+ std::vector<bool> is_valid = {true, true, true, false, true, true,
+ true, true, true, false, true, true,
+ true, true, true, false, true, true,
+ true, true, true, false, true, true};
auto t_s = ::arrow::timestamp(TimeUnit::SECOND);
auto t_ms = ::arrow::timestamp(TimeUnit::MILLI);
auto t_us = ::arrow::timestamp(TimeUnit::MICRO);
auto t_ns = ::arrow::timestamp(TimeUnit::NANO);
- std::vector<int64_t> s_values = {1489269, 1489270, 1489271, 1489272, 1489272, 1489273};
+ std::vector<int64_t> s_values = {1489269, 1489270, 1489271, 1489272, 1489272, 1489273,
+ 1489269, 1489270, 1489271, 1489272, 1489272, 1489273,
+ 1489269, 1489270, 1489271, 1489272, 1489272, 1489273,
+ 1489269, 1489270, 1489271, 1489272, 1489272, 1489273};
std::vector<int64_t> ms_values = {1489269000, 1489270000, 1489271000,
+ 1489272001, 1489272000, 1489273000,
+ 1489269000, 1489270000, 1489271000,
+ 1489272001, 1489272000, 1489273000,
+ 1489269000, 1489270000, 1489271000,
+ 1489272001, 1489272000, 1489273000,
+ 1489269000, 1489270000, 1489271000,
1489272001, 1489272000, 1489273000};
std::vector<int64_t> us_values = {1489269000000, 1489270000000, 1489271000000,
+ 1489272000001, 1489272000000, 1489273000000,
+ 1489269000000, 1489270000000, 1489271000000,
+ 1489272000001, 1489272000000, 1489273000000,
+ 1489269000000, 1489270000000, 1489271000000,
+ 1489272000001, 1489272000000, 1489273000000,
+ 1489269000000, 1489270000000, 1489271000000,
1489272000001, 1489272000000, 1489273000000};
std::vector<int64_t> ns_values = {1489269000000000LL, 1489270000000000LL,
1489271000000000LL, 1489272000000001LL,
+ 1489272000000000LL, 1489273000000000LL,
+ 1489269000000000LL, 1489270000000000LL,
+ 1489271000000000LL, 1489272000000001LL,
+ 1489272000000000LL, 1489273000000000LL,
+ 1489269000000000LL, 1489270000000000LL,
+ 1489271000000000LL, 1489272000000001LL,
+ 1489272000000000LL, 1489273000000000LL,
+ 1489269000000000LL, 1489270000000000LL,
+ 1489271000000000LL, 1489272000000001LL,
1489272000000000LL, 1489273000000000LL};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment