`ProductImage::resolve` panics on some product versions

未關閉 適合新手
#1,330 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
kubernetes, rust

研究方向

從crates/stackable-operator/src/commons/product_image_selection.rs:333開始,比較其中的截斷處理與utils/length_enforcement.rs以及既有的truncate_at_char_boundary方法。使用提供的KafkaCluster manifest重現問題;其中的產品版本會在UTF-8字元邊界觸發panic。完成標準是解析該版本時不再觸發panic,且operator能繼續進行協調。

由索引模型根據 Issue 內容生成。

描述

scheduled-for/27.3.0

https://github.com/stackabletech/operator-rs/blob/b0b8ca31a79da03b3fa20507b709390d2647efe4/crates/stackable-operator/src/commons/product_image_selection.rs#L333

That uses truncate which panics when the new_len doesn't fall on a char boundary.

`product_image_selection.rs:333:31` (`assertion failed: self.is_char_boundary(new_len)`), `main` exits via `JoinError::Panic`

A fix could/would be to use truncate(formatted.floor_char_boundary(LABEL_VALUE_MAX_LEN)), as utils/length_enforcement.rs already does, or reject non-ASCII versions and tags. And I actually see that we have a truncate_at_char_boundary method as well but it's private right now.

The problem here is that a single "bad" CR kills the entire operator and no other thing reconciles.

To reproduce:

# productVersion: 40 x U+00E9 (two bytes each), so byte 63 falls inside a character.
apiVersion: kafka.stackable.tech/v1alpha1
kind: KafkaCluster
metadata:
  name: bad-version
spec:
  image:
    productVersion: "éééééééééééééééééééééééééééééééééééééééé"
  clusterConfig:
    metadataManager: KRaft
  controllers:
    roleGroups:
      default:
        replicas: 1
  brokers:
    roleGroups:
      default:
        replicas: 1
主要語言
Rust
星號
170
分支
20
平均合併
1 天 10 小時
30 天內合併 PR
17

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

stackabletech/operator-rs 的其他 Issue

查看 stackabletech/operator-rs 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。