diff options
author | thek@adventure.(none) <> | 2007-05-07 10:23:10 +0200 |
---|---|---|
committer | thek@adventure.(none) <> | 2007-05-07 10:23:10 +0200 |
commit | ae10d3d9e222653c6ad43a5c29d105e1c8a3995c (patch) | |
tree | 2bff0cc91cb05a081ba21c79a104862facc39de5 /sql/sp_head.cc | |
parent | 10dd997019733e7545d91ae590d0af59df55f8fd (diff) | |
download | mariadb-git-ae10d3d9e222653c6ad43a5c29d105e1c8a3995c.tar.gz |
Bug#26977 exception handlers never hreturn
- In some cases, flow control optimization implemented in sp::optimize
removes hreturn instructions, causing SQL exception handlers to:
* never return
* execute wrong logic
- This patch overrides default short cut optimization on hreturn instructions
to avoid this problem.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 1ebef4f8bee..5a1faf50296 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -2982,10 +2982,20 @@ sp_instr_hreturn::print(String *str) uint sp_instr_hreturn::opt_mark(sp_head *sp, List<sp_instr> *leads) { - if (m_dest) - return sp_instr_jump::opt_mark(sp, leads); - marked= 1; + + if (m_dest) + { + /* + This is an EXIT handler; next instruction step is in m_dest. + */ + return m_dest; + } + + /* + This is a CONTINUE handler; next instruction step will come from + the handler stack and not from opt_mark. + */ return UINT_MAX; } |