Bug #42461 Plugins: st_mysql_lex_string differs between plugin.h and m_string.h

Submitted: 29 Jan 2009 17:51 Modified: 14 Jul 2009 16:03
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Storage Engine API Severity:S3 (Non-critical)
Version:6.0-bzr OS:Any
Assigned to: Magne Mæhre CPU Architecture:Any

[29 Jan 2009 17:51] Guilhem Bichot
Description:
Haven't checked 5.1.
include/plugin.h contains:
/* This definition must match the one given in m_string.h */
struct st_mysql_lex_string
{
  char *str;
  unsigned int length;
};
(note the comment!) but include/m_string.h contains:
/* This definition must match the one given in mysql/plugin.h */
struct st_mysql_lex_string
{
  char *str;
  size_t length;
};
Alas, they don't match: one has "unsigned int" the other has "size_t"; it is quite possible on some platforms that the first is 4 bytes but the second 8 bytes.
We should decide what type we want and stick to it. Then we will be able to decide how to fix the multiple compiler warnings which arise from size_t->uint conversions when st_mysql_lex_string::length is cast to uint.

How to repeat:
look at code.

Suggested fix:
Triage team, this is probably a simple fix, and patent violation of the comments ("must match" etc) sounds no good, it could lead to a mismatch between engine and mysqld (thus crashing) so please don't make it a very low priority thing. Thanks!
[29 Jan 2009 17:51] Guilhem Bichot
correction: include/mysql/plugin.h is the file name
[29 Jan 2009 17:54] Davi Arnaut
Duplicate of Bug#31865?
[29 Jan 2009 18:00] Guilhem Bichot
Oh man, yes, duplicate of that bug which was filed more than a year ago.
I disagree strongly with the category "feature request". It's a bug. It's bound to create crashes with an engine which would make use of the LEX_STRING structure.
[29 Apr 2009 20:58] 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/73067

2768 Magne Mahre	2009-04-29
      Bug #42461 Plugins: st_mysql_lex_string differs between plugin.h and m_string.h
      
      include/m_string.h and include/mysql/plugin.h had different definition
      of the type of the length attribute (size_t vs. unsigned int).
      
      Decided to use size_t as the common type, as this is the type used
      in the Single Unix Specification everywhere a string's length is
      given.
      
      No specific test case is added, as several existing test cases use
      MYSQL_LEX_STRING from plugins (in particular the maria suite).
[30 Apr 2009 14:51] Alexander Nozdrin
The patch is approved.
[30 Apr 2009 16:58] 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/73211

2770 Magne Mahre	2009-04-30
      Bug #42461 Plugins: st_mysql_lex_string differs between plugin.h and m_string.h
            
      include/m_string.h and include/mysql/plugin.h had different definition
      of the type of the length attribute (size_t vs. unsigned int).
            
      Decided to use size_t as the common type, as this is the type used
      in the Single Unix Specification everywhere a string's length is
      given.
            
      No specific test case is added, as several existing test cases use
      MYSQL_LEX_STRING from plugins (in particular the maria suite).
[16 May 2009 8:41] Bugs System
Pushed into 6.0.12-alpha (revid:alik@sun.com-20090516083402-0avycdy7w6dnn0tv) (version source revid:serg@mysql.com-20090512164111-jz224w5781lhe7wd) (merge vers: 6.0.12-alpha) (pib:6)
[14 Jul 2009 13:25] MC Brown
Internal change only. No changelog entry required.
[14 Jul 2009 14:22] Sergei Golubchik
no, this isn't "internal".
Suggested changelog entry: "A problem in plugin.h - plugins could be getting a definition of MYSQL_LEX_STRING which was different from the server expectations. It would cause affected plugins to crash."
[14 Jul 2009 16:03] MC Brown
A note has been added to the 6.0.12 changelog: 

A problem in plugin.h - plugins could be getting a definition of MYSQL_LEX_STRING which was different from the server expectations. It would cause affected plugins to crash

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.043 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.