• pem@mysql.com's avatar
    Fixed BUG#16887: Cursor causes server segfault · cfba31dd
    pem@mysql.com authored
      The problem was a code generation bug: cpop instructions were not generated
      when using ITERATE back to an outer block from a context with a declared
      cursor; this would make it push a new cursor without popping in-between,
      eventually overrunning the cursor stack with a crash as the result.
      Fixed the calculation of how many cursors to pop (in sp_pcontext.cc:
      diff_cursors()), and also corrected diff_cursors() and diff_handlers()
      to when doing a "leave"; don't include the last context we're leaving
      (we are then jumping to the appropriate pop instructions).
    cfba31dd
sp_pcontext.cc 9.33 KB