mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 06:20:06 +00:00
* string/stratcliff.c (do_test): Test for zero length
STRNLEN, MEMCHR, STRNCPY, STPNCPY, MEMCPY, MEMPCPY and memccpy at the end of the page.
This commit is contained in:
parent
4300afc169
commit
15417de3e0
@ -1,3 +1,9 @@
|
|||||||
|
2009-05-09 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* string/stratcliff.c (do_test): Test for zero length
|
||||||
|
STRNLEN, MEMCHR, STRNCPY, STPNCPY, MEMCPY, MEMPCPY and memccpy
|
||||||
|
at the end of the page.
|
||||||
|
|
||||||
2009-05-08 Ulrich Drepper <drepper@redhat.com>
|
2009-05-08 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_AT_RANDOM.
|
* sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_AT_RANDOM.
|
||||||
|
@ -129,10 +129,10 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
|
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
|
||||||
{
|
{
|
||||||
for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
|
for (inner = MAX (outer, nchars - 64); inner <= nchars; ++inner)
|
||||||
{
|
{
|
||||||
if (STRNLEN (&adr[outer], inner - outer + 1)
|
if (STRNLEN (&adr[outer], inner - outer)
|
||||||
!= (size_t) (inner - outer + 1))
|
!= (size_t) (inner - outer))
|
||||||
{
|
{
|
||||||
printf ("%s flunked bounded for outer = %d, inner = %d\n",
|
printf ("%s flunked bounded for outer = %d, inner = %d\n",
|
||||||
STRINGIFY (STRNLEN), outer, inner);
|
STRINGIFY (STRNLEN), outer, inner);
|
||||||
@ -225,7 +225,7 @@ do_test (void)
|
|||||||
adr[middle] = L('T');
|
adr[middle] = L('T');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
|
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
|
||||||
{
|
{
|
||||||
CHAR *cp = MEMCHR (&adr[outer], L('V'), nchars - outer);
|
CHAR *cp = MEMCHR (&adr[outer], L('V'), nchars - outer);
|
||||||
|
|
||||||
@ -279,9 +279,9 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* strncpy tests */
|
/* strncpy/wcsncpy tests */
|
||||||
adr[nchars - 1] = L('T');
|
adr[nchars - 1] = L('T');
|
||||||
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
|
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
@ -355,6 +355,24 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* stpncpy/wcpncpy test */
|
/* stpncpy/wcpncpy test */
|
||||||
|
adr[nchars - 1] = L('T');
|
||||||
|
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
for (len = 0; len < nchars - outer; ++len)
|
||||||
|
{
|
||||||
|
if (STPNCPY (dest, &adr[outer], len) != dest + len
|
||||||
|
|| MEMCMP (dest, &adr[outer], len) != 0)
|
||||||
|
{
|
||||||
|
printf ("outer %s flunked for outer = %d, len = %Zd\n",
|
||||||
|
STRINGIFY (STPNCPY), outer, len);
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
adr[nchars - 1] = L('\0');
|
||||||
|
|
||||||
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
|
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
|
||||||
{
|
{
|
||||||
for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
|
for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
|
||||||
@ -378,7 +396,7 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* memcpy/wmemcpy test */
|
/* memcpy/wmemcpy test */
|
||||||
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
|
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
|
||||||
for (inner = 0; inner < nchars - outer; ++inner)
|
for (inner = 0; inner < nchars - outer; ++inner)
|
||||||
if (MEMCPY (dest, &adr[outer], inner) != dest)
|
if (MEMCPY (dest, &adr[outer], inner) != dest)
|
||||||
{
|
{
|
||||||
@ -388,7 +406,7 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* mempcpy/wmempcpy test */
|
/* mempcpy/wmempcpy test */
|
||||||
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
|
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
|
||||||
for (inner = 0; inner < nchars - outer; ++inner)
|
for (inner = 0; inner < nchars - outer; ++inner)
|
||||||
if (MEMPCPY (dest, &adr[outer], inner) != dest + inner)
|
if (MEMPCPY (dest, &adr[outer], inner) != dest + inner)
|
||||||
{
|
{
|
||||||
@ -401,7 +419,7 @@ do_test (void)
|
|||||||
#ifndef WCSTEST
|
#ifndef WCSTEST
|
||||||
/* memccpy test */
|
/* memccpy test */
|
||||||
memset (adr, '\0', nchars);
|
memset (adr, '\0', nchars);
|
||||||
for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
|
for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
|
||||||
for (inner = 0; inner < nchars - outer; ++inner)
|
for (inner = 0; inner < nchars - outer; ++inner)
|
||||||
if (memccpy (dest, &adr[outer], L('\1'), inner) != NULL)
|
if (memccpy (dest, &adr[outer], L('\1'), inner) != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user