Skip to content

Commit

Permalink
AVRO-3964: Fix out-of-bounds panic (#2821)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Stanovoy <[email protected]>
  • Loading branch information
alexstanovoy and Alexander Stanovoy authored Mar 25, 2024
1 parent 03ea96b commit 74486c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lang/rust/avro/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 74486c7

Please sign in to comment.