[ 
https://issues.apache.org/jira/browse/KUDU-3749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18067013#comment-18067013
 ] 

ASF subversion and git services commented on KUDU-3749:
-------------------------------------------------------

Commit 7787e6615480130620f6acc79b99a7d9ef9b351d in kudu's branch 
refs/heads/master from Gabriella Lotz
[ https://gitbox.apache.org/repos/asf?p=kudu.git;h=7787e6615 ]

KUDU-3749 Fix range key hex encoding

ksck, auto-rebalancer, and PartitionKey::DebugString() serialize
range keys into hex strings. Make the encoding consistent and safe by
treating each byte as unsigned before widening, avoiding signed-char
sign extension.

Change-Id: I6d7f0304c0f5bb88ae79a28c740a8791c2eaa03a
Reviewed-on: http://gerrit.cloudera.org:8080/24086
Reviewed-by: Zoltan Chovan <[email protected]>
Tested-by: Zoltan Chovan <[email protected]>
Reviewed-by: Marton Greber <[email protected]>
Tested-by: Marton Greber <[email protected]>


> 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
>            Priority: Major
>
> ksck, auto_rebalancer, and PartitionKey::DebugString() hex‑encode range/hash 
> keys by streaming raw bytes into ostringstream. If char is signed and the 
> range key contains bytes ≥ 0x80, the current static_cast<uint16_t>(key[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>(key[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)
> src/kudu/common/partition.cc (PartitionKey::DebugString())



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to