Bug #33465 Temporarily disable fix for bug#26503
Submitted: 21 Dec 2007 17:15 Modified: 29 Jan 2008 15:44
Reporter: Marc ALFF Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Parser Severity:S1 (Critical)
Version:5.0.40, 5.1.17, 5.0.52 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[21 Dec 2007 17:15] Marc ALFF
Description:
Bug#26503 (Illegal SQL exception handler code causes the server to crash)
was fixed in 5.0.40 and 5.1.17

With this fix, stored procedures that were:
- illegal
- *appeared* to run
- might or might not cause a server crash / execute invalid SQL logic
in versions up to 5.0.39 included (5.1.16 included)
are now treated as follows with the fix:
- the procedure is rejected by the parser.

While the fix itself is correct, forcing users to rework invalid user code
during an upgrade from 5.0.39 to 5.0.40 or later is very inconvenient.
When the need for the upgrade is to get unrelated critical fixes only available
in version 5.0.40 or later, having to rework illegal stored procedure code as a
pre-requisite to upgrade delays the availability of the fix.

The desired behavior is to implement a server start option that disable the
check implemented by bug#26503.

IMPORTANT:
=============================================================================
Note that this option is by nature dangerous,
as it re-introduces all the flaws fixed by bug#26503, and can lead to server
crashes or invalid SQL logic executed inside a stored procedure.
=============================================================================

With this option, a user will have the option to:
- upgrade from 5.0.39 or earlier to a recent version, to get unrelated critical
  bug fixes
- choose to not rework illegal stored procedures but disable the correction
  for bug#26503 instead
- get up and running with a more recent server (while bug#26503 will still
  exist)
- delay the re-work illegal stored procedures to a later, planned time
- after illegal stored procedures have been fixed in user code, restart the
  server with normal options (without disabling the code enforcing integrity
  in bug#26503)

How to repeat:
See bug#26503

Suggested fix:
Disable the logic enforcing the check (sp_pcontext::find_label)
[21 Dec 2007 22:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/40363

ChangeSet@1.2583, 2007-12-21 15:53:02-07:00, malff@lambda.hsd1.co.comcast.net. +9 -0
  Bug#33465 (Temporarily disable fix for bug 26503)
  
  Before this fix, updating the logic in stored procedure using illegal labels in
  exception handler was a mandatory pre-requisite to upgrade from 5.0.39 or older
  to 5.0.40 or newer (or respectively: 5.1.16 or older to 5.1.17 or newer).
  
  With this fix, a server start option --disable-fix-26503=TRUE allows
  to postpone this mandatory upgrade of user code to a later time.
  
  This option is critical when upgrading to a recent server code is needed
  in emergency.
[29 Jan 2008 15:44] Konstantin Osipov
The patch has been provided to support team for application to the custom tree.