• Alexander Barkov's avatar
    MDEV-20667 Server crash on pop_cursor · e0f9540b
    Alexander Barkov authored
    When backpatching a forward GOTO label, the old code erroneously
    used CURSOR/HANDLER difference between context frames "c" and "a" to tune
    a cpop/hpop command. So the cpop/hpop command later tried to pop
    all cursors/handlers declared between "a" and "c", but those between
    "b" and "c" were not cpushed/hpoped yet during the execution of "GOTO x".
    
    Fixing the code to use the difference between frames "b" and "a" only.
    
    BEGIN     -- a
     ...
    GOTO x;   -- b
     ...
    <<x>>     -- c
     ...
    END       -- d
    e0f9540b
sp_head.cc 143 KB