From 8a79a28b5f2d948a99729b1fb05c7d0dc5d8a73e Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Thu, 29 Aug 2024 14:54:00 +0200 Subject: [PATCH] unknown attributes --- src/classfile.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/classfile.rs b/src/classfile.rs index ade0917..7859d9a 100644 --- a/src/classfile.rs +++ b/src/classfile.rs @@ -549,7 +549,9 @@ impl AttributeInfo { let mut attr_vec = Vec::with_capacity(length.into()); for _i in 0..length { - attr_vec.push(AttributeInfo::from_reader(reader, &pool)?); + let attribute = AttributeInfo::from_reader(reader, &pool)?; + println!("{:#?}", attribute); + attr_vec.push(attribute); } Ok(attr_vec.into_boxed_slice()) @@ -585,8 +587,6 @@ impl AttributeInfo { } }; - println!("{:#?}", data); - Ok( AttributeInfo { attribute_name_index, @@ -618,7 +618,7 @@ impl MethodInfo { } fn read_buffer(reader: &mut dyn Read, size: usize) -> Result, Error> { - let mut buffer: Box<[u8]> = Vec::::with_capacity(size).into_boxed_slice(); + let mut buffer: Box<[u8]> = vec![0; size].into_boxed_slice(); reader.read_exact(&mut buffer)?;