This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new dc52f38d7 AVRO-3964: Fix out-of-bounds panic (#2821)
dc52f38d7 is described below

commit dc52f38d70fe9614fb6a0890e0262ae2714ecf42
Author: Alexander Stanovoy <[email protected]>
AuthorDate: Mon Mar 25 15:59:06 2024 +0400

    AVRO-3964: Fix out-of-bounds panic (#2821)
    
    Co-authored-by: Alexander Stanovoy <[email protected]>
    (cherry picked from commit 74486c79049eca5c8805b68eed0504ba0705bf8a)
---
 lang/rust/avro/src/decode.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lang/rust/avro/src/decode.rs b/lang/rust/avro/src/decode.rs
index 86584d3e0..41c3f24ab 100644
--- a/lang/rust/avro/src/decode.rs
+++ b/lang/rust/avro/src/decode.rs
@@ -323,7 +323,7 @@ pub(crate) fn decode_internal<R: Read, S: Borrow<Schema>>(
             Ok(if let Value::Int(raw_index) = decode_int(reader)? {
                 let index = usize::try_from(raw_index)
                     .map_err(|e| Error::ConvertI32ToUsize(e, raw_index))?;
-                if (0..=symbols.len()).contains(&index) {
+                if (0..symbols.len()).contains(&index) {
                     let symbol = symbols[index].clone();
                     Value::Enum(raw_index as u32, symbol)
                 } else {

Reply via email to