google / souper

A superoptimizer for LLVM IR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect switch case fall through

mshockwave opened this issue · comments

Hi,
The getValue function in souperPass (lib/Pass/Pass.cpp) try to recursively generate corresponding LLVM IR instructions for a fragment of souper IR. However, in the case where it try to handle two-operand souper Inst, it doesn't close the case with a break statement.
Thus, if an operand Inst is not supported (i.e. cannot be handled by the inner switch), the control flow will fall through to next case, which performs an out-of-bound operand access and crash the program.