Skip to content

MINOR: [C++][ORC] Avoid signed overflow when converting timestamps#50035

Open
jmestwa-coder wants to merge 1 commit into
apache:mainfrom
jmestwa-coder:orc-timestamp-nanos-overflow
Open

MINOR: [C++][ORC] Avoid signed overflow when converting timestamps#50035
jmestwa-coder wants to merge 1 commit into
apache:mainfrom
jmestwa-coder:orc-timestamp-nanos-overflow

Conversation

@jmestwa-coder
Copy link
Copy Markdown

A far-future ORC timestamp (after ~2262) makes AppendTimestampBatch in cpp/src/arrow/adapters/orc/util.cc overflow int64 nanoseconds in seconds * kOneSecondNanos + nanos. Reducing the multiply under -fsanitize=signed-integer-overflow:

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

Detect it with MultiplyWithOverflow/AddWithOverflow and return Status::Invalid for out-of-range values.

@kou
Copy link
Copy Markdown
Member

kou commented May 25, 2026

@wgtmac
Copy link
Copy Markdown
Member

wgtmac commented May 26, 2026

I agree with @kou. Changes like this require an issue. The change itself looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants