Skip to content

Commit

Permalink
fix[ir]: fix a latent bug in sha3_64 codegen (#4063)
Browse files Browse the repository at this point in the history
this commit fixes a latent bug in `sha3_64` asm generation, where the
second argument to `sha3_64` is generated with the wrong stack height

note the bug cannot currently be triggered from vyper source code
(hence, it is latent), because there is nowhere in IR generation that
the second item is accessed as a witharg.

patches GHSA-6845-xw22-ffxv
  • Loading branch information
charles-cooper authored May 30, 2024
1 parent dcec257 commit d9f9fda
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vyper/ir/compile_ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,9 @@ def _height_of(witharg):
# SHA3 a 64 byte value
elif code.value == "sha3_64":
o = _compile_to_assembly(code.args[0], withargs, existing_labels, break_dest, height)
o.extend(_compile_to_assembly(code.args[1], withargs, existing_labels, break_dest, height))
o.extend(
_compile_to_assembly(code.args[1], withargs, existing_labels, break_dest, height + 1)
)
o.extend(
[
*PUSH(MemoryPositions.FREE_VAR_SPACE2),
Expand Down

0 comments on commit d9f9fda

Please sign in to comment.