Skip to content

Commit 2e58693

Browse files
committed
fix
Signed-off-by: happy-v587 <code4happy@gmail.com>
1 parent 8a9196c commit 2e58693

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/storage/src/redis_multi.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,15 @@ impl Redis {
396396
// Get score from value
397397
let parsed_value = ParsedInternalValue::new(&value);
398398
let score_bytes = parsed_value.user_value();
399-
let score = f64::from_le_bytes(score_bytes[0..8].try_into().expect("slice length mismatch"));
400-
399+
let score_raw: [u8; 8] = score_bytes
400+
.get(0..8)
401+
.and_then(|b| b.try_into().ok())
402+
.ok_or_else(|| {
403+
StorageError::InvalidFormat(
404+
"Invalid zset score payload length (expected 8 bytes)".to_string(),
405+
)
406+
})?;
407+
let score = f64::from_le_bytes(score_raw);
401408
// Create score key
402409
let new_score_key = self.encode_zsets_score_key(new_key, version, score, member);
403410
let score_value = InternalValue::new(DataType::None, &[]);

0 commit comments

Comments
 (0)