From cfb01a5c8abf29b61decc6da8629d7e0ffb4d6aa Mon Sep 17 00:00:00 2001 From: zaits07 Date: Thu, 17 Sep 2026 15:54:18 +0300 Subject: [PATCH] fix cp_infos_from_context() while reading constant pool we should skip one index in result after long and double constants. i.e. we shoud add dummy const after long or double constant; index after long and double reserved: https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.4.5 --- asm/src/impls/jvms/r/jvms_reader.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/asm/src/impls/jvms/r/jvms_reader.rs b/asm/src/impls/jvms/r/jvms_reader.rs index f9bc7f4..4189e62 100644 --- a/asm/src/impls/jvms/r/jvms_reader.rs +++ b/asm/src/impls/jvms/r/jvms_reader.rs @@ -46,13 +46,14 @@ fn cp_infos_from_context(context: &mut ReadContext, max_len: usize) -> AsmResult while max_len > 0 { let tag: u8 = context.read()?; let info: Const = Const::from_context(context, tag)?; + result.push(CPInfo { tag, info }); match tag { Constants::CONSTANT_Long | Constants::CONSTANT_Double => { + result.push(CPInfo { tag: 0, info: Const::Invalid }); max_len -= 2; }, _ => { max_len -= 1; } } - result.push(CPInfo { tag, info }); }; Ok(result) }