[MDEV-20667] Server crash on pop_cursor Created: 2019-09-25 Updated: 2019-12-12 Resolved: 2019-12-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Procedure |
| Affects Version/s: | 10.4.7, 10.4.8, 10.3, 10.4 |
| Fix Version/s: | 10.3.22, 10.4.12 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Jérôme Brauge | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS 7 |
||
| Attachments: |
|
| Description |
|
Conjunction of cursor and "goto" statement in stored procedure cause crash with stack: |
| Comments |
| Comment by Alice Sherepa [ 2019-09-26 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Thanks a lot! Reproduced on debug version 10.3-10.4:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-09-27 ] | ||||||||||||||||||||||||||||||||||||||||||
|
also crashes. Befor the crash, it prints the following procedure code:
The above code is wrong. The execution goes this way:
It seems the cpop at position 6 should not be there. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-12-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The same problem is repeatable with this script, with an unconditional GOTO jump at the end:
Notice, the cpop at position 5 looks wrong. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-12-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
A similar crash happens with handlers instead of cursors:
SHOW PROCEDURE CODE p1 displays this output:
The hpop on the 10th position does not have any corresponding hpush commands, hence the crash. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-12-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Hi Varun, Can you please review a fix for https://github.com/MariaDB/server/commit/599b92768b57a514360280dbdf810e7e3c985dec Thanks! |