neo icon indicating copy to clipboard operation
neo copied to clipboard

vm: Instruction pointer reading PUSHDATA4 operand size as *signed* int32

Open devhawk opened this issue 3 years ago • 2 comments

https://github.com/neo-project/neo-vm/blob/f48de7e595ade7c72be6ccd5cce0ab99708f0afd/src/Neo.VM/Instruction.cs#L214

SHouldn't this be using BinaryPrimitives.ReadUInt32LittleEndian?

devhawk avatar Aug 24 '22 17:08 devhawk

I've traced this behavior right up to 10df514393734437541bf6c249f4352371787c21, so looks like int32 parameter to PUSHDATA4 have existed since the beginning of time. We've pointed at it once with neo-project/neo-vm#438, but it was fixed in neo-project/neo-vm#439 with the check below, so I think it's left this way intentionally. I'd rather do it with uint32 too, but given that the check is there and we can't have an element bigger than 1M (and there are even stricter limits for NEF or entry script size), it probably doesn't matter.

roman-khimov avatar Aug 24 '22 17:08 roman-khimov

I think that we should change it

shargon avatar Nov 10 '23 11:11 shargon

Because Instruction.Size is int and this change is not required because is already checked, I will close it, if you consider is important, we can reopen it.

shargon avatar Jan 08 '25 09:01 shargon