Skip to content

[C++][ORC] Signed integer overflow when converting far-future timestamps #50078

@jmestwa-coder

Description

@jmestwa-coder

Describe the bug, including details regarding any error messages, version, and platform.

AppendTimestampBatch in cpp/src/arrow/adapters/orc/util.cc converts ORC second + nanosecond timestamps to Arrow int64 nanoseconds with a bare seconds * kOneSecondNanos + nanos. For a timestamp past ~year 2262 the multiply does not fit in int64, which is signed integer overflow (UB).

Reducing the expression under -fsanitize=signed-integer-overflow:

runtime error: signed integer overflow:
  10000000000 * 1000000000 cannot be represented in type 'int64_t'

The conversion should detect the out-of-range case and return an error instead of computing the product with undefined behavior.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions