summaryrefslogtreecommitdiff
path: root/strings
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.3' into 10.4Oleksandr Byelkin2022-01-3012-73/+73
|\
| * Merge branch '10.2' into 10.3mariadb-10.3.33Oleksandr Byelkin2022-01-2912-72/+72
| |\
| | * MDEV-27494 Rename .ic files to .inlVladislav Vaintroub2022-01-1712-72/+72
| | |
* | | MDEV-25904 New collation functions to compare InnoDB style trimmed NO PAD ↵bb-10.4-bar-MDEV-25904Alexander Barkov2022-01-2122-108/+577
| | | | | | | | | | | | strings
* | | MDEV-27552 Change the return type of my_uca_context_weight_find() to ↵bb-10.4-bar-MDEV-27552Alexander Barkov2022-01-202-28/+30
| | | | | | | | | | | | MY_CONTRACTION*
* | | Merge 10.3 into 10.4Marko Mäkelä2021-11-092-6/+6
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2021-11-092-6/+6
| |\ \ | | |/
| | * MDEV-24335 Unexpected question mark in the end of a TINYTEXT columnAlexander Barkov2021-11-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | my_copy_fix_mb() passed MIN(src_length,dst_length) to my_append_fix_badly_formed_tail(). It could break a multi-byte character in the middle, which put the question mark to the destination. Fixing the code to pass the true src_length to my_append_fix_badly_formed_tail().
| | * MDEV-24901 SIGSEGV in fts_get_table_name, SIGSEGV in ib_vector_size, SIGSEGV ↵bb-10.2-bar-MDEV-24901Alexander Barkov2021-10-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in row_merge_fts_doc_tokenize, stack smashing strmake() puts one extra 0x00 byte at the end of the string. The code in my_strnxfrm_tis620[_nopad] did not take this into account, so in the reported scenario the 0x00 byte was put outside of a stack variable, which made ASAN crash. This problem is already fixed in in MySQL: commit 19bd66fe43c41f0bde5f36bc6b455a46693069fb Author: bin.x.su@oracle.com <> Date: Fri Apr 4 11:35:27 2014 +0800 But the fix does not seem to be correct, as it breaks when finds a zero byte in the source string. Using memcpy() instead of strmake(). - Unlike strmake(), memcpy() it does not write beyond the destination size passed. - Unlike the MySQL fix, memcpy() does not break on the first 0x00 byte found in the source string.
* | | Fix all warnings given by UBSANMonty2021-04-203-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The easiest way to compile and test the server with UBSAN is to run: ./BUILD/compile-pentium64-ubsan and then run mysql-test-run. After this commit, one should be able to run this without any UBSAN warnings. There is still a few compiler warnings that should be fixed at some point, but these do not expose any real bugs. The 'special' cases where we disable, suppress or circumvent UBSAN are: - ref10 source (as here we intentionally do some shifts that UBSAN complains about. - x86 version of optimized int#korr() methods. UBSAN do not like unaligned memory access of integers. Fixed by using byte_order_generic.h when compiling with UBSAN - We use smaller thread stack with ASAN and UBSAN, which forced me to disable a few tests that prints the thread stack size. - Verifying class types does not work for shared libraries. I added suppression in mysql-test-run.pl for this case. - Added '#ifdef WITH_UBSAN' when using integer arithmetic where it is safe to have overflows (two cases, in item_func.cc). Things fixed: - Don't left shift signed values (byte_order_generic.h, mysqltest.c, item_sum.cc and many more) - Don't assign not non existing values to enum variables. - Ensure that bool and enum values are properly initialized in constructors. This was needed as UBSAN checks that these types has correct values when one copies an object. (gcalc_tools.h, ha_partition.cc, item_sum.cc, partition_element.h ...) - Ensure we do not called handler functions on unallocated objects or deleted objects. (events.cc, sql_acl.cc). - Fixed bugs in Item_sp::Item_sp() where we did not call constructor on Query_arena object. - Fixed several cast of objects to an incompatible class! (Item.cc, Item_buff.cc, item_timefunc.cc, opt_subselect.cc, sql_acl.cc, sql_select.cc ...) - Ensure we do not do integer arithmetic that causes over or underflows. This includes also ++ and -- of integers. (Item_func.cc, Item_strfunc.cc, item_timefunc.cc, sql_base.cc ...) - Added JSON_VALUE_UNITIALIZED to json_value_types and ensure that value_type is initialized to this instead of to -1, which is not a valid enum value for json_value_types. - Ensure we do not call memcpy() when second argument could be null. - Fixed that Item_func_str::make_empty_result() creates an empty string instead of a null string (safer as it ensures we do not do arithmetic on null strings). Other things: - Changed struct st_position to an OBJECT and added an initialization function to it to ensure that we do not copy or use uninitialized members. The change to a class was also motived that we used "struct st_position" and POSITION randomly trough the code which was confusing. - Notably big rewrite in sql_acl.cc to avoid using deleted objects. - Changed in sql_partition to use '^' instead of '-'. This is safe as the operator is either 0 or 0x8000000000000000ULL. - Added check for select_nr < INT_MAX in JOIN::build_explain() to avoid bug when get_select() could return NULL. - Reordered elements in POSITION for better alignment. - Changed sql_test.cc::print_plan() to use pointers instead of objects. - Fixed bug in find_set() where could could execute '1 << -1'. - Added variable have_sanitizer, used by mtr. (This variable was before only in 10.5 and up). It can now have one of two values: ASAN or UBSAN. - Moved ~Archive_share() from ha_archive.cc to ha_archive.h and marked it virtual. This was an effort to get UBSAN to work with loaded storage engines. I kept the change as the new place is better. - Added in CONNECT engine COLBLK::SetName(), to get around a wrong cast in tabutil.cpp. - Added HAVE_REPLICATION around usage of rgi_slave, to get embedded server to compile with UBSAN. (Patch from Marko). - Added #ifdef for powerpc64 to avoid a bug in old gcc versions related to integer arithmetic. Changes that should not be needed but had to be done to suppress warnings from UBSAN: - Added static_cast<<uint16_t>> around shift to get rid of a LOT of compiler warnings when using UBSAN. - Had to change some '/' of 2 base integers to shift to get rid of some compile time warnings. Reviewed by: - Json changes: Alexey Botchkov - Charset changes in ctype-uca.c: Alexander Barkov - InnoDB changes & Embedded server: Marko Mäkelä - sql_acl.cc changes: Vicențiu Ciorbaru - build_explain() changes: Sergey Petrunia
* | | Merge branch '10.3' into 10.4Sergei Golubchik2021-02-231-4/+59
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Sergei Golubchik2021-02-221-4/+59
| |\ \ | | |/
| | * MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong resultAlexander Barkov2021-02-081-4/+59
| | |
* | | Merge branch 'bb-10.3-release' into bb-10.4-releaseSergei Golubchik2021-02-121-2/+8
|\ \ \ | |/ / | | | | | | | | | Note, the fix for "MDEV-23328 Server hang due to Galera lock conflict resolution" was null-merged. 10.4 version of the fix is coming up separately
| * | Merge branch '10.2' into 10.3Sergei Golubchik2021-02-011-2/+8
| |\ \ | | |/
| | * ucs2: cppcheck - add va_endbb-10.2-danielblack-cppcheckDaniel Black2021-01-211-2/+8
| | |
* | | Merge 10.3 into 10.4Marko Mäkelä2020-11-032-4/+6
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-11-022-4/+6
| |\ \ | | |/
| | * MDEV-22387: Do not violate __attribute__((nonnull))Marko Mäkelä2020-11-022-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up commit commit 94a520ddbe39ae97de1135d98699cf2674e6b77e and commit 7c5519c12d46ead947d341cbdcbb6fbbe4d4fe1b. After these changes, the default test suites on a cmake -DWITH_UBSAN=ON build no longer fail due to passing null pointers as parameters that are declared to never be null, but plenty of other runtime errors remain.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-10-291-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-10-281-1/+1
| |\ \ | | |/
| | * MDEV-23941: strings/json_lib.c:893:12: style: Suspicious conditionVicențiu Ciorbaru2020-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The characters parsed are always ascii characters, hence one byte. This means that the code did not have "incorrect" logic because the boolean condition, if true, would also evaluate to the value of 1. The condition however is semantically wrong, assuming a length is equal to the condition outcome. Change paranthesis to make it also read according to the intent.
* | | Merge branch '10.3' into 10.4Sujatha2020-09-281-2/+4
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Sujatha2020-09-281-2/+4
| |\ \ | | |/
| | * MDEV-22387: Do not violate __attribute__((nonnull))Marko Mäkelä2020-09-231-2/+4
| | | | | | | | | | | | | | | | | | | | | Passing a null pointer to a nonnull argument is not only undefined behaviour, but it also grants the compiler the permission to optimize away further checks whether the pointer is null. GCC -O2 at least starting with version 8 may do that, potentially causing SIGSEGV.
* | | Merge 10.3 into 10.4, except MDEV-22543Marko Mäkelä2020-08-131-1/+1
|\ \ \ | |/ / | | | | | | Also, fix GCC -Og -Wmaybe-uninitialized in run_backup_stage()
| * | Merge 10.2 into 10.3Marko Mäkelä2020-08-131-1/+1
| |\ \ | | |/
| | * Fix GCC 10.2.0 -Og -Wmaybe-uninitializedMarko Mäkelä2020-08-111-1/+1
| | | | | | | | | | | | | | | | | | For some reason, GCC emits more -Wmaybe-uninitialized warnings when using the flag -Og than when using -O2. Many of the warnings look genuine.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-08-101-0/+18
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-08-101-0/+18
| |\ \ | | |/
| | * Merge 10.1 into 10.2Marko Mäkelä2020-08-101-0/+18
| | |\
| | | * MDEV-23105 Cast number string with many leading zeros to decimal gives ↵Alexander Barkov2020-08-051-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | unexpected result Skip leading zeros when converting a string to decimal_t.
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-07-021-1/+7
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2020-07-021-1/+7
| |\ \ \ | | |/ /
| | * | MDEV-20377: Make WITH_MSAN more usableMarko Mäkelä2020-07-011-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MemorySanitizer (clang -fsanitize=memory) requires that all code be compiled with instrumentation enabled. The only exception is the C runtime library. Failure to use instrumented libraries will cause bogus messages about memory being uninitialized. In WITH_MSAN builds, we must avoid calling getservbyname(), because even though it is a standard library function, it is not instrumented, not even in clang 10. Note: Before MariaDB Server 10.5, ./mtr will typically fail due to the old PCRE library, which was updated in MDEV-14024. The following cmake options were tested on 10.5 in commit 94d0bb4dbeb28a94d1f87fdd55f4297ff3df0157: cmake \ -DCMAKE_C_FLAGS='-march=native -O2' \ -DCMAKE_CXX_FLAGS='-stdlib=libc++ -march=native -O2' \ -DWITH_EMBEDDED_SERVER=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug \ -DWITH_INNODB_{BZIP2,LZ4,LZMA,LZO,SNAPPY}=OFF \ -DPLUGIN_{ARCHIVE,TOKUDB,MROONGA,OQGRAPH,ROCKSDB,CONNECT,SPIDER}=NO \ -DWITH_SAFEMALLOC=OFF \ -DWITH_{ZLIB,SSL,PCRE}=bundled \ -DHAVE_LIBAIO_H=0 \ -DWITH_MSAN=ON MEM_MAKE_DEFINED(): An alias for VALGRIND_MAKE_MEM_DEFINED() and __msan_unpoison(). MEM_GET_VBITS(), MEM_SET_VBITS(): Aliases for VALGRIND_GET_VBITS(), VALGRIND_SET_VBITS(), __msan_copy_shadow(). InnoDB: Replace the UNIV_MEM_ macros with corresponding MEM_ macros. ut_crc32_8_hw(), ut_crc32_64_low_hw(): Use the compiler built-in functions instead of inline assembler when building WITH_MSAN. This will require at least -msse4.2 when building for IA-32 or AMD64. The inline assembler would not be instrumented, and would thus cause bogus failures.
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-06-131-15/+11
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2020-06-131-15/+11
| |\ \ \ | | |/ /
| | * | MDEV-22849 Reuse skip_trailing_space() in my_hash_sort_utf8mbXAlexander Barkov2020-06-101-15/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replacing the slow loop in my_hash_sort_utf8mbX() to the fast skip_trailing_spaces(), which consumes 8 bytes in one iteration, and is around 8 times faster on long data. Also, renaming: - my_hash_sort_utf8() to my_hash_sort_utf8mb3() - my_hash_sort_utf8_nopad() to my_hash_sort_utf8mb3_nopad() to merge to 10.5 easier (automatically?).
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-05-261-20/+35
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2020-05-251-20/+35
| |\ \ \ | | |/ /
| | * | MDEV-22545: my_vsnprintf behaves not as in C standardOleksandr Byelkin2020-05-241-20/+35
| | | | | | | | | | | | | | | | Added parameter %T for string which should be visibly truncated.
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-04-161-5/+61
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | | | | | In main.index_merge_myisam we remove the test that was added in commit a2d24def8cc42d27c72d833abfb39ef24a2b96ba because it duplicates the test case that was added in commit 5af12e463549e4bbc2ce6ab720d78937d5e5db4e.
| * | | Merge 10.2 into 10.3Marko Mäkelä2020-04-151-5/+61
| |\ \ \ | | |/ /
| | * | MDEV-20604: Duplicate key value is silently truncated to 64 characters in ↵Oleksandr Byelkin2020-04-011-5/+61
| | | | | | | | | | | | | | | | | | | | | | | | print_keydup_error Added indication of truncated string for "s" and "M" formats
* | | | MDEV-5313: Fix GCC 10 -Wenum-conversionMarko Mäkelä2020-03-161-1/+9
| | | |
* | | | Fixed compiler warnings from gcc 7.4.1Monty2020-01-294-8/+12
| | | | | | | | | | | | | | | | - Fixed possible error in rocksdb/rdb_datadic.cc
* | | | Merge 10.3 into 10.4Marko Mäkelä2019-12-272-6/+14
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-12-272-6/+14
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-12-232-6/+14
| | |\ \ | | | |/
| | | * Merge remote-tracking branch 'origin/5.5' into 10.1Alexander Barkov2019-12-162-6/+14
| | | |\