chore(avm)!: resolve execution TODOs#19501
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
jeanmon
left a comment
There was a problem hiding this comment.
Great changes. I think there is an undefined behavior but not due to your changes.
Could you please check this @fcarreiro ?
| // This helper handles operand conversion. In particular it converts enums to their underlying type first. | ||
| auto convert_operand = []<typename T>(const Operand& op) -> T { | ||
| if constexpr (std::is_enum_v<T>) { | ||
| return static_cast<T>(op.to<std::underlying_type_t<T>>()); |
|
|
||
| MemoryValue result; | ||
|
|
||
| EnvironmentVariable env_var = static_cast<EnvironmentVariable>(var_enum); |
There was a problem hiding this comment.
Seems that is undefined behvior. https://stackoverflow.com/questions/33607809/can-an-out-of-range-enum-conversion-produce-a-value-outside-the-underlying-type
Not created by your PR @fcarreiro though but for this case I think we need keep the uint8_t value guarding by env_var <= EnvironmentVariable::MAX.
I think the tag is fine because it should have been filtered earlier in the read_instruction().
There was a problem hiding this comment.
Flakey Tests🤖 says: This CI run detected 3 tests that failed, but were tolerated due to a .test_patterns.yml entry. |
Merge activity
|
BEGIN_COMMIT_OVERRIDE feat(avm security): add static check for isolated/unused columns (#19489) feat(avm): use noop calldata hasher in fast sim (#19495) chore(avm): rename indirect -> addressing mode (#19491) chore(avm): small cursor optimizations chore(avm):! rename indirect -> addressing mode (PIL) (#19493) fix(avm): constraint when unwinding empty call stack (#19485) feat(avm): Fuzz debug log and refactor env getter (#19494) fix!: ecc add predicate completeness bug (#19471) chore(avm): callstackmetadatacollector clarifications (#19490) chore: sanity assert in execution for bytecode id (#19486) fix!: sstore allowed injection of malicious write rows (#19470) fix!: defensive ghost row constraints in bc_hashing pil (#19481) fix(avm): fix execution::mov for mac? (#19507) chore(avm)!: resolve execution TODOs (#19501) fix!: multiple traces had ghost row injection vulnerabilities (#19480) fix(avm): defensively copy MemoryValues (#19512) feat: align TS and BB log levels (#19518) END_COMMIT_OVERRIDE

Note: MemoryTag can be used directly because it's validated during instruction fetching. For EnvironmentVariable, we need to use uint8_t until we do the proper validation.