#2481·oceanbase

Large valid scheduled-trigger intervals cause signed 64-bit overflow

Author: Wwwing301Created Sep 9, 2026Updated Sep 9, 2026

Self Checks

  • I have read the Contributing Guide.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

OceanBase version

OceanBase CE 5.0.2.0, source revision d128661ca4f5b3d167c1928e556d70d2f901baef.

Self Hosted

Self Hosted (Source)

Environment

Ubuntu 22.04.5 LTS, x86_64. The component was compiled with GCC 9.5.0 and -fsanitize=undefined -fno-sanitize-recover=undefined. The attached poc.py needs Python 3, g++, and a checkout of the affected OceanBase source.

Steps to reproduce

  1. Save the single attached file as poc.py.

  2. Run it against the OceanBase checkout:

    bash
    python3 poc.py /path/to/oceanbase
  3. The PoC first verifies that the source still accepts interval_val <= INT32_MAX and contains the affected multiplication in src/share/balance/ob_scheduled_trigger_partition_balance.cpp.

  4. It compiles the same accepted-domain arithmetic with UBSan and runs one safe control plus the two values used in the source-anchored reproduction.

Observed output is equivalent to:

control: value=100 freq=60 result=6000000000
daily trigger: runtime error: signed integer overflow: 17280000000000 * 1000000 cannot be represented in type 'long int'
weekly trigger: runtime error: signed integer overflow: 18144000000000 * 1000000 cannot be represented in type 'long int'
REPRODUCED: accepted interval domain overflows int64 arithmetic

The affected code parses the interval into int64_t, permits any positive value up to INT32_MAX, selects SECS_PER_DAY or seven days, and then executes:

cpp
interval_ts = interval_val * freq_ts * USECS_PER_SEC;

The authoritative exact-function run had two clean controls and two UBSan failures. The result file SHA-256 is 570ecd1317f124c82031a125f3296076f4d91c9d47b149587e3b3bb4cdbe3b79.

poc.py

✔️ Expected Behavior

The parser should either reject an interval whose microsecond value cannot fit in int64_t, or perform checked multiplication and return a clear range error. No accepted input should invoke signed-overflow undefined behavior.

❌ Actual Behavior

Large DAILY and WEEKLY interval values pass the explicit INT32_MAX validation and then overflow the signed 64-bit multiplication. UBSan stops at the current assignment. Without UBSan, the computed scheduling interval can wrap to an unrelated value.