From 0f9e585480edcdf1e30dc3d79e24b84aeee516fa Mon Sep 17 00:00:00 2001 From: Leonhard Holz Date: Tue, 13 Jan 2015 11:33:56 +0530 Subject: Fix memory handling in strxfrm_l [BZ #16009] [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. --- NEWS | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'NEWS') diff --git a/NEWS b/NEWS index b7c32ad..fbf133e 100644 --- a/NEWS +++ b/NEWS @@ -10,14 +10,14 @@ Version 2.21 * The following bugs are resolved with this release: 6652, 10672, 12847, 12926, 13862, 14132, 14138, 14171, 14498, 15215, - 15884, 16191, 16469, 16617, 16619, 16657, 16740, 16857, 17192, 17266, - 17273, 17344, 17363, 17370, 17371, 17411, 17460, 17475, 17485, 17501, - 17506, 17508, 17522, 17555, 17570, 17571, 17572, 17573, 17574, 17582, - 17583, 17584, 17585, 17589, 17594, 17601, 17608, 17616, 17625, 17630, - 17633, 17634, 17635, 17647, 17653, 17657, 17658, 17664, 17665, 17668, - 17682, 17717, 17719, 17722, 17723, 17724, 17725, 17732, 17733, 17744, - 17745, 17746, 17747, 17748, 17775, 17777, 17780, 17781, 17782, 17791, - 17793, 17796, 17797, 17803, 17806, 17834 + 15884, 16009, 16191, 16469, 16617, 16619, 16657, 16740, 16857, 17192, + 17266, 17273, 17344, 17363, 17370, 17371, 17411, 17460, 17475, 17485, + 17501, 17506, 17508, 17522, 17555, 17570, 17571, 17572, 17573, 17574, + 17582, 17583, 17584, 17585, 17589, 17594, 17601, 17608, 17616, 17625, + 17630, 17633, 17634, 17635, 17647, 17653, 17657, 17658, 17664, 17665, + 17668, 17682, 17717, 17719, 17722, 17723, 17724, 17725, 17732, 17733, + 17744, 17745, 17746, 17747, 17748, 17775, 17777, 17780, 17781, 17782, + 17791, 17793, 17796, 17797, 17803, 17806, 17834 * Added support for TSX lock elision of pthread mutexes on powerpc32, powerpc64 and powerpc64le. This may improve lock scaling of existing programs on -- cgit v1.1