-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-49329: [C++][Parquet][CI] Add fuzz target for encoder/decoder roundtrip #49374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,28 +183,18 @@ | |
| #endif | ||
|
|
||
| // ---------------------------------------------------------------------- | ||
| // Macros to enforce struct member packing | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need changes in this file?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This exposes the macros that I've used elsewhere. I could have reused the old "manually aligned" macros but I found them difficult to understand (why try to force both alignment and packing); besides, their naming was not namespace with either ARROW_ or PARQUET_. |
||
|
|
||
| // macros to disable padding | ||
| // these macros are portable across different compilers and platforms | ||
| //[https://github.com/google/flatbuffers/blob/master/include/flatbuffers/flatbuffers.h#L1355] | ||
| #if !defined(MANUALLY_ALIGNED_STRUCT) | ||
| # if defined(_MSC_VER) | ||
| # define MANUALLY_ALIGNED_STRUCT(alignment) \ | ||
| __pragma(pack(1)); \ | ||
| struct __declspec(align(alignment)) | ||
| # define STRUCT_END(name, size) \ | ||
| __pragma(pack()); \ | ||
| static_assert(sizeof(name) == size, "compiler breaks packing rules") | ||
| # elif defined(__GNUC__) || defined(__clang__) | ||
| # define MANUALLY_ALIGNED_STRUCT(alignment) \ | ||
| _Pragma("pack(1)") struct __attribute__((aligned(alignment))) | ||
| # define STRUCT_END(name, size) \ | ||
| _Pragma("pack()") static_assert(sizeof(name) == size, \ | ||
| "compiler breaks packing rules") | ||
| # else | ||
| # error Unknown compiler, please define structure alignment macros | ||
| # endif | ||
| #endif // !defined(MANUALLY_ALIGNED_STRUCT) | ||
| #if defined(__GNUC__) | ||
| # define ARROW_PACKED_START(KEYWORD, ...) KEYWORD [[gnu::packed]] __VA_ARGS__ | ||
| # define ARROW_PACKED_END | ||
| #elif defined(_MSC_VER) | ||
| # define ARROW_PACKED_START(KEYWORD, ...) _Pragma("pack(push, 1)") KEYWORD __VA_ARGS__ | ||
| # define ARROW_PACKED_END _Pragma("pack(pop)") | ||
| #else | ||
| # define ARROW_PACKED_START(KEYWORD, ...) KEYWORD __VA_ARGS__ | ||
| # define ARROW_PACKED_END | ||
| #endif | ||
|
|
||
| // ---------------------------------------------------------------------- | ||
| // Convenience macro disabling a particular UBSan check in a function | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| #include "arrow/status.h" | ||
| #include "arrow/util/fuzz_internal.h" | ||
| #include "parquet/arrow/fuzz_encoding_internal.h" | ||
|
|
||
| extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | ||
| auto status = | ||
| parquet::fuzzing::internal::FuzzEncoding(data, static_cast<int64_t>(size)); | ||
| arrow::internal::LogFuzzStatus(status, data, static_cast<int64_t>(size)); | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be behind a
"${ARROW_PARQUET}" == "ON"check, similar to below?