From d8df119cfd70ca45848b591533e4bbd169b0c050 Mon Sep 17 00:00:00 2001 From: Julien Le Dem Date: Thu, 11 Aug 2016 09:40:13 -0700 Subject: [PATCH] ARROW-253: restrict ints to 8, 16, 32, or 64 bits in V1 --- cpp/src/arrow/ipc/metadata-internal.cc | 9 ++++----- format/Message.fbs | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cpp/src/arrow/ipc/metadata-internal.cc b/cpp/src/arrow/ipc/metadata-internal.cc index 1b1d50f96ea..3a7cc6e1fc0 100644 --- a/cpp/src/arrow/ipc/metadata-internal.cc +++ b/cpp/src/arrow/ipc/metadata-internal.cc @@ -55,12 +55,12 @@ const std::shared_ptr DOUBLE = std::make_shared(); static Status IntFromFlatbuffer( const flatbuf::Int* int_data, std::shared_ptr* out) { - if (int_data->bitWidth() % 8 != 0) { - return Status::NotImplemented("Integers not in cstdint are not implemented"); - } if (int_data->bitWidth() > 64) { return Status::NotImplemented("Integers with more than 64 bits not implemented"); } + if (int_data->bitWidth() < 8) { + return Status::NotImplemented("Integers with less than 8 bits not implemented"); + } switch (int_data->bitWidth()) { case 8: @@ -76,8 +76,7 @@ static Status IntFromFlatbuffer( *out = int_data->is_signed() ? INT64 : UINT64; break; default: - *out = nullptr; - break; + return Status::NotImplemented("Integers not in cstdint are not implemented"); } return Status::OK(); } diff --git a/format/Message.fbs b/format/Message.fbs index fc849eedf79..52a8db9a8fd 100644 --- a/format/Message.fbs +++ b/format/Message.fbs @@ -24,7 +24,7 @@ table Bit { } table Int { - bitWidth: int; // 1 to 64 + bitWidth: int; // restricted to 8, 16, 32, and 64 in v1 is_signed: bool; }