List:Bugs« Previous MessageNext Message »
From:John Calder Date:May 30 2000 12:13am
Subject:substring incorrect syntax causes crash
View as plain text  
Bug report
MySQL Win32 3.23.14 crashes on getting an SQL syntax wrong.
Following SQL query is incorrect, has "substring" where I should
have used "substring_index" but the punishment is a little 
excessive! ie complete engine crash!

select A0 from wptact where A0 like 'MISMATCH%' 
order by substring(A0, "*", -1) desc limit 1;

The correct syntax works well.

Windows says:

MYSQLD-OPT caused an invalid page fault in
module MYSQLD-OPT.EXE at 015f:00471fe4.
Registers:
EAX=00000101 CS=015f EIP=00471fe4 EFLGS=00010206
EBX=00000004 SS=0167 ESP=0179f688 EBP=00000002
ECX=00a91a30 DS=0167 ESI=00000004 FS=355f
EDX=00a92ea0 ES=0167 EDI=00000001 GS=0000
Bytes at CS:EIP:
8a 10 3a 11 75 2d 8a 50 01 3a 51 01 75 34 8a 50 
Stack dump:
0179f6ec 00000004 00471dd7 0179f714 00a92ec0 00a92ea0 
00a92eb0 00000000 009893a8 00a91070 0040b511 0179f6ec 
00a92eb0 00000001 00a92e90 00a95020 

----------------------------------------------------------

The background: in emulating PICK we are stuck with one only
primary key, so 2-field keys are, in this case, simulated
by using values with a separator eg
MISMATCH*0
MISMATCH*1
MISMATCH*2

This may seem like a pain in the neck, but it has the spin
off benefit of making it easier to implement a multi-user
locking scheme, one field value stored in a "locks" table 
with the user connection_id simply identifies one record.
This is why I requested the connection_id() function!

The purpose of the query is to find the highest number in use
after a * for generating a new key for writing a new record.

Thread
substring incorrect syntax causes crashJohn Calder30 May
  • substring incorrect syntax causes crashMichael Widenius30 May
    • serious bug allows anyone access to database as rootBrad Johnson30 May
      • RE: serious bug allows anyone access to database as rootjason30 May
      • Re: serious bug allows anyone access to database as rootMichael Labbe30 May
      • No Risk - Re: serious bug allows anyone access to database as rootNick Lindridge31 May
RE: serious bug allows anyone access to database as rootMatt Vermette30 May
  • Re: serious bug allows anyone access to database as rootsasha31 May
    • Re: serious bug allows anyone access to database as rootMichael Widenius5 Jun