Gabriella Lotz created KUDU-3749:
------------------------------------
Summary: Fix range_key_begin hex encoding to avoid signed-char
sign extension
Key: KUDU-3749
URL: https://issues.apache.org/jira/browse/KUDU-3749
Project: Kudu
Issue Type: Bug
Reporter: Gabriella Lotz
Assignee: Gabriella Lotz
Both ksck and auto_rebalancer hex‑encode range_key_begin by streaming raw bytes
into ostringstream. If char is signed and the range key contains bytes ≥ 0x80,
the current static_cast<uint16_t>(range_key_begin[i]) will sign‑extend,
producing incorrect hex output (e.g., ff becomes ffff). This is a correctness
issue in the encoded representation and can lead to inconsistent range tags
between components.
Proposed fix: Use an unsigned byte cast before widening in both places, e.g.:
static_cast<uint16_t>(static_cast<uint8_t>(range_key_begin[i]))
or an equivalent helper to ensure 0–255 semantics.
Locations:
src/kudu/tools/ksck.cc (range_key_begin formatting)
src/kudu/master/auto_rebalancer.cc (range_key_begin formatting)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)