public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17279] New: strncat(..., ..., SIZE_MAX) behaves incorrectly
@ 2014-08-16  9:58 roche at httrack dot com
  2015-08-27 22:23 ` [Bug string/17279] " jsm28 at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: roche at httrack dot com @ 2014-08-16  9:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17279

            Bug ID: 17279
           Summary: strncat(..., ..., SIZE_MAX) behaves incorrectly
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: roche at httrack dot com
                CC: drepper.fsp at gmail dot com

Created attachment 7749
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7749&action=edit
Test case

Using SIZE_MAX as third argument to strncat() should behave as if strcat() was
used.

According to POSIX
(http://pubs.opengroup.org/onlinepubs/009695399/functions/strncat.html),

"The strncat() function shall append not more than n bytes (a null byte and
bytes that follow it are not appended) from the array pointed to by s2 to the
end of the string pointed to by s1."

The wording imply that the third "n" argument is an additional boundary limit,
not the destination buffer capacity (ie. the destination buffer is not
implicitly SIZE_MAX), and both source and destination do not overlap
(overlapping depends on the source and destination layout, not on the "n"
value)

However, it seems that the optimized strncat version of the GLIBC behaves
incorrectly, when using this value.

The culprit might be in the sysdeps/x86_64/multiarch/strcat-sse2-unaligned.S
source file (see
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/multiarch/strcat-sse2-unaligned.S;h=dc782f2c2370915f74673ff8184e5f2eaf2795db;hb=HEAD)

See also the comp.unix.programmer related discussion, with a possible location
of the bug in the assembly source:
https://groups.google.com/forum/#!topic/comp.unix.programmer/qKMC4A_itLs

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-08  8:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-16  9:58 [Bug libc/17279] New: strncat(..., ..., SIZE_MAX) behaves incorrectly roche at httrack dot com
2015-08-27 22:23 ` [Bug string/17279] " jsm28 at gcc dot gnu.org
2021-08-10 11:45 ` ucelsanicin at yahoo dot com
2021-09-10 19:36 ` mehmetgelisin at aol dot com
2021-09-10 19:53 ` mark at klomp dot org
2021-09-22 16:58 ` mervegunesli at aol dot com
2021-10-09 11:00 ` gulsenenginar at aol dot com
2021-11-08  8:08 ` richardsjenkins70 at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).