aboutsummaryrefslogtreecommitdiff
path: root/string
AgeCommit message (Collapse)AuthorFilesLines
2016-07-11Merge branch 'release/2.19/master' into ibm/2.19/masteribm/2.19/masterTulio Magno Quites Machado Filho1-96/+403
Conflicts: NEWS
2016-07-11Fix memory handling in strxfrm_l [BZ #16009]Leonhard Holz1-96/+403
[Modified from the original email by Siddhesh Poyarekar] This patch solves bug #16009 by implementing an additional path in strxfrm that does not depend on caching the weight and rule indices. In detail the following changed: * The old main loop was factored out of strxfrm_l into the function do_xfrm_cached to be able to alternativly use the non-caching version do_xfrm. * strxfrm_l allocates a a fixed size array on the stack. If this is not sufficiant to store the weight and rule indices, the non-caching path is taken. As the cache size is not dependent on the input there can be no problems with integer overflows or stack allocations greater than __MAX_ALLOCA_CUTOFF. Note that malloc-ing is not possible because the definition of strxfrm does not allow an oom errorhandling. * The uncached path determines the weight and rule index for every char and for every pass again. * Passing all the locale data array by array resulted in very long parameter lists, so I introduced a structure that holds them. * Checking for zero src string has been moved a bit upwards, it is before the locale data initialization now. * To verify that the non-caching path works correct I added a test run to localedata/sort-test.sh & localedata/xfrm-test.c where all strings are patched up with spaces so that they are too large for the caching path. (cherry picked from commit 0f9e585480edcdf1e30dc3d79e24b84aeee516fa) Conflicts: NEWS string/strxfrm_l.c
2015-03-13Merge branch 'release/2.19/master' into ibm/2.19/masterTulio Magno Quites Machado Filho1-0/+28
2014-08-28PowerPC: optimized memmove for POWER7/PPC64Adhemerval Zanella1-1/+1
This patch adds an optimized memmove optimization for POWER7/powerpc64. Basically the idea is to use the memcpy for POWER7 on non-overlapped memory regions and a optimized backward memcpy for memory regions that overlap (similar to the idea of string/memmove.c). The backward memcpy algorithm used is similar the one use for memcpy for POWER7, with adjustments done for alignment. The difference is memory is always aligned to 16 bytes before using VSX/altivec instructions.
2014-05-01Fix v9/64-bit strcmp when string ends in multiple zero bytes.David S. Miller1-0/+28
[BZ #16885] * sysdeps/sparc/sparc64/strcmp.S: Fix end comparison handling when multiple zero bytes exist at the end of a string. Reported by Aurelien Jarno <aurelien@aurel32.net> * string/test-strcmp.c (check): Add explicit test for situations where there are multiple zero bytes after the first.
2014-03-21PowerPC: optimized strpbrk for POWER7Adhemerval Zanella1-10/+6
This patch add an optimized strpbrk for POWER7 by using a different algorithm than default implementation: it constructs a table based on the 'accept' argument and use this table to check for any occurance on the input string. The idea is similar as x86_64 uses. For PowerPC some tunings were added, such as unroll loops and memory clear using VSX instructions. Backport of 6f23d0939e9651d8ac3c77a835fb6464b35a1dc4
2014-03-21PowerPC: optimized strcspn for PPC64/POWER7Adhemerval Zanella1-15/+6
This patch add a optimized strcspn for POWER7 by using a different algorithm than default implementation: it constructs a table based on the 'accept' argument and use this table to check for any occurance on the input string. The idea is similar as x86_64 uses. For PowerPC some tunings were added, such as unroll loops and align stack memory to table to 16 bytes (so VSX clean can ran without alignment issues). Backport of 6eaf95cbfa0031ea267682dc2c9c17ed3e3dc167
2014-03-11PowerPC: strspn optimization for PPC64/POWER7Vidya Ranganathan1-3/+4
The optimization is achieved by following techniques: > hashing of needle. > hashing avoids scanning of duplicate entries in needle across the string. > initializing the hash table with Vector instructions (VSX) by quadword access. > unrolling when scanning for character in string across hash table.
2014-03-03PowerPC: strrchr optimization for POWER7/PPC64Rajalakshmi Srinivasaraghavan1-1/+5
This patch optimizes strrchr() for ppc64. It uses aligned memory access along with cmpb instruction and CPU prefetch to avoid cache misses for speed improvement. Backport of c7debbdfacbef150aaf9113eb05ccaf2b9e7af6c
2014-01-01Update copyright notices with scripts/update-copyrightsAllan McRae121-121/+121
2013-12-23Define __CORRECT_ISO_CPP_STRING_H_PROTO correctly for Clang.Brooks Moses2-4/+12
In the string/string.h and string/strings.h headers, we have a couple of macros that "tell the caller that we provide correct C++ prototypes" according to the comment; they are used to determine whether to wrap some prototypes in "extern "C++"" (and provide multiple overloads of them, and some other magic) when __cplusplus is defined. The macros are set to check for sufficiently-recent GCC versions (4.4 and later), but this is not the right check for non-GCC compilers. In particular, these macros should also be set when using Clang -- if they are not set, then Clang will be unable to correctly diagnose a number of subtle bugs that will be errors in GCC compilations. As per discussion on earlier versions of this patch, rather than restrict the fix to Clang per se, we assume that all C++ compilers that claim to fully support C++98 are using a standard-conforming C++ standard library, which seems pretty reasonable. Clang has been providing an appropriate value of __cplusplus since May 2012.
2013-12-13PowerPC: multiarch wordcopy for PowerPC64Adhemerval Zanella1-16/+20
2013-12-13PowerPC: multirach memcmp for PowerPC64Adhemerval Zanella1-1/+5
2013-12-06PowerPC: multiarch strchrnul for PowerPC32Adhemerval Zanella1-1/+5
2013-12-06PowerPC: multiarch rawmemchr for PowerPC32Adhemerval Zanella1-1/+4
2013-12-06PowerPC: multiarch memchr for PowerPC32Adhemerval Zanella1-1/+5
2013-12-06PowerPC: multiarch mempcpy for PowerPC32Adhemerval Zanella1-1/+5
2013-11-26Remove duplicate ifunc tests.Ondřej Bílka34-645/+1
2013-11-10Fix build on hurdSamuel Thibault1-0/+1
* string/strcoll_l.c: Include <sys/param.h> for MIN/MAX macros.
2013-10-04string/tester memrchr testAlan Modra1-3/+3
http://sourceware.org/ml/libc-alpha/2013-08/msg00095.html I found this useful at one stage when I was seeing a huge number of memrchr failures all of test number 10. * string/tester.c (test_memrchr): Increment reported test cycle.
2013-10-04string/test-memcpy error reportingAlan Modra1-2/+2
http://sourceware.org/ml/libc-alpha/2013-08/msg00094.html Using plain %s here runs the risk of segfaulting when displaying the string. src and dst aren't zero terminated strings. * string/test-memcpy.c (do_one_test): When reporting errors, print string address and don't overrun end of string.
2013-09-23Check for integer overflow in cache size computation in strcollSiddhesh Poyarekar3-1/+72
strcoll is implemented using a cache for indices and weights of collation sequences in the strings so that subsequent passes do not have to search through collation data again. For very large string inputs, the cache size computation could overflow. In such a case, use the fallback function that does not cache indices and weights of collation sequences. Fixes CVE-2012-4412.
2013-09-23Fall back to non-cached sequence traversal and comparison on malloc failSiddhesh Poyarekar1-31/+234
strcoll currently falls back to alloca if malloc fails, resulting in a possible stack overflow. This patch implements sequence traversal and comparison without caching indices and rules. Fixes CVE-2012-4424.
2013-09-20Make __ffs hiddenAndreas Schwab1-0/+1
2013-09-05Add memrchr testcaseAdhemerval Zanella3-1/+190
2013-08-27Fix missing declaration of LC_CTYPE nonascii-case elementAndreas Schwab3-8/+48
2013-08-20Simplify strcoll implementationSiddhesh Poyarekar1-406/+295
Break up strcoll into simpler functions so that the logic is easier to follow and maintain.
2013-06-26Add a test for BZ #15674H.J. Lu1-0/+24
2013-06-20Fix loop construction to functions callsAdhemerval Zanella4-0/+4
Check wheter the compiler has the option -fno-tree-loop-distribute-patterns to inhibit loop transformation to library calls and uses it on memset and memmove default implementation to avoid recursive calls.
2013-06-11Remove performance-related bits from string testsSiddhesh Poyarekar25-620/+0
2013-06-07Avoid use of "register" as optimization hint.Joseph Myers5-22/+22
2013-06-04Add copyright header to test-strchrnul.cSiddhesh Poyarekar1-0/+19
2013-05-16Add #include <stdint.h> for uint[32|64]_t usage (except installed headers).Ryan S. Arnold1-1/+1
2013-05-01Remove duplicate __strcmp_cgOndrej Bilka1-24/+1
The __strcmp_cg code was duplicate of of __strcmp_gc. This patch unifies these two cases into one.
2013-02-17Sort Versions filesAndreas Jaeger1-2/+2
2013-02-15Remove bounded-pointers build system support.Joseph Myers1-4/+0
2013-02-15Remove miscellaneous bounded-pointers relics in C code.Joseph Myers1-1/+1
2013-02-14Remove bp-sym.h and BP_SYM uses from C code.Joseph Myers1-6/+1
2013-02-13Remove __ptrvalue, __bounded and __unbounded.Joseph Myers1-1/+1
2013-02-13Call memcpy in generic mempcpyOndrej Bilka1-36/+2
2013-02-12Fix typo, improve comment, remove superfluous #undefs, add missing #undef.Tom de Vries1-5/+7
2013-02-11Remove dead CFLAGS lines from string/MakefileTom de Vries1-2/+0
2013-02-08Remove dead variable in generic strcpy.Roland McGrath1-3/+0
2013-02-08Remove CHECK_BOUNDS_LOW and CHECK_BOUNDS_HIGH for C code.Joseph Myers1-5/+2
2013-02-07Remove lots of inline keywords.Roland McGrath1-3/+0
2013-01-11Remove __GLIBC_HAVE_LONG_LONG.Joseph Myers2-15/+9
2013-01-11Add --enable-hardcoded-path-in-tests configure optionH.J. Lu1-1/+1
2013-01-10Remove __GNUC__ conditions for "long long" from string.h and wchar.h.Joseph Myers1-2/+0
2013-01-02Update copyright notices with scripts/update-copyrights.Joseph Myers149-158/+149
2012-12-27BZ#14317: Optimze __xpg_strerror_r2012-12-27 Bruno Haible1-9/+15
[BZ #14317] * string/xpg-strerror.c (__xpg_strerror_r): Optimize, call strlen only if needed.