1. 13 Aug, 2010 1 commit
    • Georgi Kodinov's avatar
      Bug #55615 and bug #55564 · 0db116d7
      Georgi Kodinov authored
      An user assignment variable expression that's 
      evaluated in a logical expression context 
      (Item::val_bool()) can be pre-calculated in a 
      temporary table for GROUP BY.
      However when the expression value is used after the
      temp table creation it was re-evaluated instead of
      being read from the temp table due to a missing 
      val_bool_result() method.
      Fixed by implementing the method.
      0db116d7
  2. 06 Aug, 2010 1 commit
    • Gleb Shchepa's avatar
      Bug #55424: convert_tz crashes when fed invalid data · 96d3fbe8
      Gleb Shchepa authored
      The CONVERT_TZ function crashes the server when the
      timezone argument is an empty SET field value.
      
      1) The CONVERT_TZ may find a timezone string in the
         tz_names hash.
      2) A string representation of the empty SET is a
         String of zero length with the NULL pointer.
      3) If the key argument length is zero, hash functions
         do comparison using the length of the record being
         compared against.
      
      I.e. a zero-length String buffer is an invalid
      argument for hash search functions, and if String
      points to NULL buffer, hashcmp() fails with SEGV
      accessing that memory.
      
      The my_tz_find function has been modified to
      treat empty Strings as invalid timezone values
      to skip unnecessary hash search.
      
      
      mysql-test/r/timezone2.result:
        Test case for bug #55424.
      mysql-test/t/timezone2.test:
        Test case for bug #55424.
      sql/sql_string.h:
        Bug #55424: convert_tz crashes when fed invalid data
        
        Added "const" modifier to String::is_empty().
      sql/tztime.cc:
        Bug #55424: convert_tz crashes when fed invalid data
        
        The my_tz_find function has been modified to
        treat empty Strings as invalid timezone values
        to skip unnecessary hash search.
      96d3fbe8
  3. 05 Aug, 2010 2 commits
    • Sunny Bains's avatar
      Fix Bug #55277 - Failing assertion: auto_inc > 0 · 9d58f16b
      Sunny Bains authored
      Handle overflow when reading value from SELECT MAX(C) FROM T;
      
      Call ha_innobase::info() after initializing the autoinc value
      in ha_innobase::open().
      
      Fix for both the builtin and plugin.
      
      rb://402
      9d58f16b
    • Sunny Bains's avatar
      Fix bug# 55543 - InnoDB Plugin: Signal 6: Assertion failure in file fil/fil0fil.c line 4306 · 1e218ba2
      Sunny Bains authored
      The bug is due to a double delete of a BLOB, once via:
      
          rollback -> btr_cur_pessimistic_delete()
      
      and the second time via purge.
      
      The bug is in row_upd_clust_rec_by_insert(). There we relinquish ownership
      of the non-updated BLOB columns in btr_cur_mark_extern_inherited_fields()
      before building the row entry that will be inserted and whose contents will
      be logged in the UNDO log. However, we don't set the BLOB column later to
      INHERITED so that a possible rollback will not free the original row's
      non-updated BLOB entries. This is because the condition that checks for
      that is in :
      
      	if (node->upd_ext) {}.
      
      node->upd_ext is non-NULL only if a BLOB column was updated and that column
      is part of some key ordering (see row_upd_replace()). This results in the
      non-update BLOB columns being deleted during a rollback and subsequently by
      purge again.
      
      rb://413
      1e218ba2
  4. 04 Aug, 2010 2 commits
  5. 03 Aug, 2010 2 commits
  6. 02 Aug, 2010 4 commits
    • Alfranio Correia's avatar
      BUG#55625 RBR breaks on failing 'CREATE TABLE' · a94f5b60
      Alfranio Correia authored
      A CREATE...SELECT that fails is written to the binary log if a non-transactional
      statement is updated. If the logging format is ROW, the CREATE statement and the
      changes are written to the binary log as distinct events and by consequence the
      created table is not rolled back in the slave.
      
      In this patch, we opted to let the slave goes out of sync by not writting to the
      binary log the CREATE statement. We do this by simply reseting the binary log's
      cache.
      
      mysql-test/suite/rpl/r/rpl_drop.result:
        Added a test case.
      mysql-test/suite/rpl/t/rpl_drop.test:
        Added a test case.
      sql/log.cc:
        Introduced a function to clean up the cache.
      sql/log.h:
        Introduced a function to clean up the cache.
      sql/sql_insert.cc:
        Cleaned up the binary log cache if a CREATE...SELECT fails.
      a94f5b60
    • Georgi Kodinov's avatar
      merge · d8e7c6df
      Georgi Kodinov authored
      d8e7c6df
    • Georgi Kodinov's avatar
      b2813477
    • Georgi Kodinov's avatar
      merge · 39589111
      Georgi Kodinov authored
      39589111
  7. 01 Aug, 2010 1 commit
    • Gleb Shchepa's avatar
      Bug #54461: crash with longblob and union or update with subquery · e50ece8f
      Gleb Shchepa authored
      Queries may crash, if
        1) the GREATEST or the LEAST function has a mixed list of
           numeric and LONGBLOB arguments and
        2) the result of such a function goes through an intermediate
           temporary table.
      
      An Item that references a LONGBLOB field has max_length of
      UINT_MAX32 == (2^32 - 1).
      
      The current implementation of GREATEST/LEAST returns REAL
      result for a mixed list of numeric and string arguments (that
      contradicts with the current documentation, this contradiction
      was discussed and it was decided to update the documentation).
      
      The max_length of such a function call was calculated as a
      maximum of argument max_length values (i.e. UINT_MAX32).
      
      That max_length value of UINT_MAX32 was used as a length for
      the intermediate temporary table Field_double to hold
      GREATEST/LEAST function result.
      
      The Field_double::val_str() method call on that field
      allocates a String value.
      
      Since an allocation of String reserves an additional byte
      for a zero-termination, the size of String buffer was
      set to (UINT_MAX32 + 1), that caused an integer overflow:
      actually, an empty buffer of size 0 was allocated.
      
      An initialization of the "first" byte of that zero-size
      buffer with '\0' caused a crash.
      
      The Item_func_min_max::fix_length_and_dec() has been
      modified to calculate max_length for the REAL result like
      we do it for arithmetical operators.
      
      
      ******
      Bug #54461: crash with longblob and union or update with subquery
      
      Queries may crash, if
        1) the GREATEST or the LEAST function has a mixed list of
           numeric and LONGBLOB arguments and
        2) the result of such a function goes through an intermediate
           temporary table.
      
      An Item that references a LONGBLOB field has max_length of
      UINT_MAX32 == (2^32 - 1).
      
      The current implementation of GREATEST/LEAST returns REAL
      result for a mixed list of numeric and string arguments (that
      contradicts with the current documentation, this contradiction
      was discussed and it was decided to update the documentation).
      
      The max_length of such a function call was calculated as a
      maximum of argument max_length values (i.e. UINT_MAX32).
      
      That max_length value of UINT_MAX32 was used as a length for
      the intermediate temporary table Field_double to hold
      GREATEST/LEAST function result.
      
      The Field_double::val_str() method call on that field
      allocates a String value.
      
      Since an allocation of String reserves an additional byte
      for a zero-termination, the size of String buffer was
      set to (UINT_MAX32 + 1), that caused an integer overflow:
      actually, an empty buffer of size 0 was allocated.
      
      An initialization of the "first" byte of that zero-size
      buffer with '\0' caused a crash.
      
      The Item_func_min_max::fix_length_and_dec() has been
      modified to calculate max_length for the REAL result like
      we do it for arithmetical operators.
      
      
      
      mysql-test/r/func_misc.result:
        Test case for bug #54461.
        
        ******
        Test case for bug #54461.
      mysql-test/t/func_misc.test:
        Test case for bug #54461.
        
        ******
        Test case for bug #54461.
      sql/item_func.cc:
        Bug #54461: crash with longblob and union or update with subquery
        
        The Item_func_min_max::fix_length_and_dec() has been
        modified to calculate max_length for the REAL result like
        we do it for arithmetical operators.
        
        ******
        Bug #54461: crash with longblob and union or update with subquery
        
        The Item_func_min_max::fix_length_and_dec() has been
        modified to calculate max_length for the REAL result like
        we do it for arithmetical operators.
      e50ece8f
  8. 30 Jul, 2010 9 commits
    • Davi Arnaut's avatar
      Bug#45288: pb2 returns a lot of compilation warnings on linux · 705ae384
      Davi Arnaut authored
      Fix compiler warnings.
      
      mysys/stacktrace.c:
        Tag unused parameters.
      sql/sql_lex.cc:
        Variable becomes unused in non-debug builds. Also, no need to
        assert the obvious.
      705ae384
    • Luis Soares's avatar
      374a6fd2
    • Georgi Kodinov's avatar
    • Luis Soares's avatar
      Revert patch for BUG#34283. Causing lots of test failures in PB2, · 2a996946
      Luis Soares authored
      mostly because existing test result files were not updated.
      2a996946
    • Georgi Kodinov's avatar
      Bug #55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results · 1670dd4d
      Georgi Kodinov authored
      In order to be able to check if the set of the grouping fields in a 
      GROUP BY has changed (and thus to start a new group) the optimizer
      caches the current values of these fields in a set of Cached_item 
      derived objects.
      The Cached_item_str, used for caching varchar and TEXT columns,
      is limited in length by the max_sort_length variable.
      A String buffer to store the value with an alloced length of either
      the max length of the string or the value of max_sort_length 
      (whichever is smaller) in Cached_item_str's constructor.
      Then, at compare time the value of the string to compare to was 
      truncated to the alloced length of the string buffer inside 
      Cached_item_str.
      This is all fine and valid, but only if you're not assigning 
      values near or equal to the alloced length of this buffer.
      Because when assigning values like this the alloced length is 
      rounded up and as a result the next set of data will not match the
      group buffer, thus leading to wrong results because of the changed
      alloced_length.
      Fixed by preserving the original maximum length in the 
      Cached_item_str's constructor and using this instead of the 
      alloced_length to limit the string to compare to.
      Test case added.
      1670dd4d
    • Davi Arnaut's avatar
      18fa4d21
    • Davi Arnaut's avatar
      Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run · 0079e33b
      Davi Arnaut authored
      Fix a regression (due to a typo) which caused spurious incorrect
      argument errors for long data stream parameters if all forms of
      logging were disabled (binary, general and slow logs).
      
      sql/sql_prepare.cc:
        Add a missing logical NOT operator.
      0079e33b
    • Davi Arnaut's avatar
      Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run · 07dcc366
      Davi Arnaut authored
      Fix a regression (due to a typo) which caused spurious incorrect
      argument errors for long data stream parameters if all forms of
      logging were disabled (binary, general and slow logs).
      
      mysql-test/t/mysql_client_test.test:
        Save the status of the slow_log.
      sql/sql_prepare.cc:
        Add a missing logical NOT operator.
      tests/mysql_client_test.c:
        Disable all query logs when running C tests. Fixes a omission
        when, slow log should have been disabled too.
        
        Run test case for Bug#54041 with query logs enabled and disabled.
      07dcc366
    • unknown's avatar
      Bug #34283 mysqlbinlog leaves tmpfile after termination if binlog contains load data infile · 7778820a
      unknown authored
      With statement- or mixed-mode logging, "LOAD DATA INFILE" queries
      are written to the binlog using special types of log events.
      When mysqlbinlog reads such events, it re-creates the file in a
      temporary directory with a generated filename and outputs a
      "LOAD DATA INFILE" query where the filename is replaced by the
      generated file. The temporary file is not deleted by mysqlbinlog
      after termination.
      
      To fix the problem, in mixed mode we go to row-based. In SBR, we
      document it to remind user the tmpfile is left in a temporary
      directory.
      
      
      mysql-test/suite/binlog/r/binlog_mixed_load_data.result:
        Test result for BUG#34283.
      mysql-test/suite/binlog/t/binlog_mixed_load_data.test:
        Added the test file to verify that 'load data infile...' statement
        will go to row-based in mixed mode.
      sql/sql_load.cc:
        Added code to go to row-based in mixed mode for
        'load data infile ...' statement
      7778820a
  9. 29 Jul, 2010 4 commits
    • Vasil Dimov's avatar
      Merge mysql-5.1-innodb -> mysql-5.1-bugteam · 681ca4f8
      Vasil Dimov authored
      681ca4f8
    • Vasil Dimov's avatar
      Merge mysql-5.1-bugteam -> mysql-5.1-innodb · 25341c06
      Vasil Dimov authored
      25341c06
    • Alexander Barkov's avatar
      Postfix for BUG#45012. · 7e00365f
      Alexander Barkov authored
      Problem: The original patch didn't compile on debug_werror
      due to wrong format in printf("%d") for size_t variables.
      
      Fix: Adding cast to (int).
      7e00365f
    • unknown's avatar
      BUG#49124 Security issue with /*!-versioned */ SQL statements on Slave · d7ad4352
      unknown authored
      /*![:version:] Query Code */, where [:version:] is a sequence of 5 
      digits representing the mysql server version(e.g /*!50200 ... */),
      is a special comment that the query in it can be executed on those 
      servers whose versions are larger than the version appearing in the 
      comment. It leads to a security issue when slave's version is larger 
      than master's. A malicious user can improve his privileges on slaves. 
      Because slave SQL thread is running with SUPER privileges, so it can
      execute queries that he/she does not have privileges on master.
      
      This bug is fixed with the logic below: 
      - To replace '!' with ' ' in the magic comments which are not applied on
        master. So they become common comments and will not be applied on slave.
      
      - Example:
        'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/
        will be binlogged as
        'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/
      
      mysql-test/suite/rpl/t/rpl_conditional_comments.test:
        Test the patch for this bug.
      sql/mysql_priv.h:
        Rename inBuf as rawBuf and remove the const limitation.
      sql/sql_lex.cc:
        To replace '!' with ' ' in the magic comments which are not applied on
        master.
      sql/sql_lex.h:
        Remove the const limitation on parameter buff, as it can be modified in the function since
        this patch.
        Add member function yyUnput for Lex_input_stream. It set a character back the query buff.
      sql/sql_parse.cc:
        Rename inBuf as rawBuf and remove the const limitation.
      sql/sql_partition.cc:
        Remove the const limitation on parameter part_buff, as it can be modified in the function since
        this patch.
      sql/sql_partition.h:
        Remove the const limitation on parameter part_buff, as it can be modified in the function since
        this patch.
      sql/table.h:
        Remove the const limitation on variable partition_info, as it can be modified since
        this patch.
      d7ad4352
  10. 28 Jul, 2010 2 commits
    • Davi Arnaut's avatar
      Bug#53463: YaSSL patch appears to be reverted · 55b50226
      Davi Arnaut authored
      The problem is that the fix Bug#29784 was mistakenly
      reverted when updating YaSSL to a newer version.
      
      The solution is to re-apply the fix and this time
      actually add a meaningful test case so that possible
      regressions are caught.
      
      extra/yassl/taocrypt/src/coding.cpp:
        Fixed buffer allocation to compute the proper maximum
        decoded size: (EncodedLength * 3/4) + 3
      mysql-test/std_data/server8k-cert.pem:
        Update certificate.
      mysql-test/std_data/server8k-key.pem:
        Update key.
      mysql-test/t/ssl_8k_key-master.opt:
        Start the server using the certificate and key that
        triggers the problem.
      55b50226
    • Jimmy Yang's avatar
      Fix bug #55581 by backporting fix of #52546 from mysql-trunk-innodb · 7277859e
      Jimmy Yang authored
      to mysql-5.1-innodb plugin.
      7277859e
  11. 24 Jul, 2010 1 commit
  12. 26 Jul, 2010 2 commits
    • Sven Sandberg's avatar
      merged BUG#55322 to 5.1-bugteam · 39ef1d4f
      Sven Sandberg authored
      39ef1d4f
    • Alexander Barkov's avatar
      Bug#45012 my_like_range_cp932 generates invalid string · be8058f5
      Alexander Barkov authored
      Problem: The functions my_like_range_xxx() returned
      badly formed maximum strings for Asian character sets,
      which made problems for storage engines.
      
      Fix: 
      - Removed a number my_like_range_xxx() implementations,
        which were in fact dumplicate code pieces.
      - Using generic my_like_range_mb() instead.
      - Setting max_sort_char member properly for Asian character sets
      - Adding unittest/strings/strings-t.c, 
        to test that my_like_range_xxx() return well-formed 
        min and max strings.
      
      Notes:
      
      - No additional tests in mysql/t/ available.
        Old tests cover the affected code well enough.
      be8058f5
  13. 23 Jul, 2010 4 commits
    • Vasil Dimov's avatar
      Increment InnoDB Plugin version to 1.0.11. · e3d4a7bc
      Vasil Dimov authored
      InnoDB Plugin 1.0.10 has been released with MySQL 5.1.49.
      e3d4a7bc
    • Alexey Kopytov's avatar
      Bug #54476: crash when group_concat and 'with rollup' in · 116931c1
      Alexey Kopytov authored
                           prepared statements
      
      Using GROUP_CONCAT() together with the WITH ROLLUP modifier
      could crash the server.
      
      The reason was a combination of several facts:
      
      1. The Item_func_group_concat class stores pointers to ORDER
      objects representing the columns in the ORDER BY clause of
      GROUP_CONCAT().
      
      2. find_order_in_list() called from
      Item_func_group_concat::setup() modifies the ORDER objects so
      that their 'item' member points to the arguments list
      allocated in the Item_func_group_concat constructor.
      
      3. In some cases (e.g. in JOIN::rollup_make_fields) a copy of
      the original Item_func_group_concat object could be created by
      using the Item_func_group_concat::Item_func_group_concat(THD
      *thd, Item_func_group_concat *item) copy constructor. The
      latter essentially creates a shallow copy of the source
      object. Memory for the arguments array is allocated on
      thd->mem_root, but the pointers for arguments and ORDER are
      copied verbatim.
      
      What happens in the test case is that when executing the query
      for the first time, after a copy of the original
      Item_func_group_concat object has been created by
      JOIN::rollup_make_fields(), find_order_in_list() is called for
      this new object. It then resolves ORDER BY by modifying the
      ORDER objects so that they point to elements of the arguments
      array which is local to the cloned object. When thd->mem_root
      is freed upon completing the execution, pointers in the ORDER
      objects become invalid. Those ORDER objects, however, are also
      shared with the original Item_func_group_concat object which is
      preserved between executions of a prepared statement. So the
      first call to find_order_in_list() for the original object on
      the second execution tries to dereference an invalid pointer.
      
      The solution is to create copies of the ORDER objects when
      copying Item_func_group_concat to not leave any stale pointers
      in other instances with different lifecycles.
      
      
      
      mysql-test/r/func_gconcat.result:
        Test case for bug #54476.
      mysql-test/t/func_gconcat.test:
        Test case for bug #54476.
      sql/item_sum.cc:
        Copy the ORDER objects pointed to by the elements of the 
        'order' array in the copy constructor of 
        Item_func_group_concat.
      sql/table.h:
        Removed the unused 'item_copy' member of the ORDER class.
      116931c1
    • Dmitry Shulga's avatar
      Merge 5.1-bugteam -> 5.1-bug-42496 · ff842973
      Dmitry Shulga authored
      ff842973
    • Vasil Dimov's avatar
      Merge mysql-5.1 -> mysql-5.1-innodb · 883a4af9
      Vasil Dimov authored
      883a4af9
  14. 22 Jul, 2010 2 commits
  15. 21 Jul, 2010 3 commits