public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/18666] New: Add support for '%OY' in strftime(), currently only "%Oy" is supported
@ 2015-07-14  9:12 sandeep.shedmake at gmail dot com
  2015-08-15 19:35 ` [Bug libc/18666] " ppluzhnikov at google dot com
  2015-08-27 22:28 ` [Bug time/18666] " jsm28 at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: sandeep.shedmake at gmail dot com @ 2015-07-14  9:12 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 18666
           Summary: Add support for '%OY' in strftime(), currently only
                    "%Oy" is supported
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: sandeep.shedmake at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 8435
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8435&action=edit
screenshot showing '%OY' instead of 4 digit year with evolution-3.16.3-2.fc22
for or_IN locale

Description of problem:
Add support for '%OY' in strftime(). Currently it doesn't support "%OY", only
"%Oy" is supported and thus 4-digit year is not possible.

Version-Release number of selected component (if applicable):
glibc-2.21-5.fc22.x86_64

How reproducible:
Always

Steps to Reproduce:
1. $ LANG=or_IN.utf8
2. $ date +%Om-%Od-%OY

Actual results:
୭-୧୩-%OY (4 digit year not supported)

Expected results:
୭-୧୩-%OY (4 digit year should be supported: ୭-୧୩-୨୦୧୫)

Additional info:
$ LANG=or_IN.utf8 date +%Om-%Od-%Oy
୭-୧୩-୧୫

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From glibc-bugs-return-28818-listarch-glibc-bugs=sources.redhat.com@sourceware.org Tue Jul 14 12:10:26 2015
Return-Path: <glibc-bugs-return-28818-listarch-glibc-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-glibc-bugs@sources.redhat.com
Received: (qmail 66852 invoked by alias); 14 Jul 2015 12:10:26 -0000
Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <glibc-bugs.sourceware.org>
List-Subscribe: <mailto:glibc-bugs-subscribe@sourceware.org>
List-Post: <mailto:glibc-bugs@sourceware.org>
List-Help: <mailto:glibc-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: glibc-bugs-owner@sourceware.org
Delivered-To: mailing list glibc-bugs@sourceware.org
Received: (qmail 66815 invoked by uid 48); 14 Jul 2015 12:10:20 -0000
From: "glibc at beer dot org.uk" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/18670] New: strcasestr and friends segfault
Date: Tue, 14 Jul 2015 12:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: glibc
X-Bugzilla-Component: libc
X-Bugzilla-Version: 2.21
X-Bugzilla-Keywords:
X-Bugzilla-Severity: critical
X-Bugzilla-Who: glibc at beer dot org.uk
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone
Message-ID: <bug-18670-131@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg00098.txt.bz2
Content-length: 2233

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

            Bug ID: 18670
           Summary: strcasestr and friends segfault
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: critical
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: glibc at beer dot org.uk
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

strcasestr (and, I presume associated functions, although this is the only one
I've tested) segfault under certain conditions (I haven't explored the range of
arguments that make it segfault).

The following snippet shows the fault :-

---8<------8<------8<------8<------8<------8<------8<---

/* Test strcasestr() */

/* Make sure we get strcasestr() and friends */
#define _GNU_SOURCE

#include <string.h>
#include <stdio.h>

void main(void)
{
    char needle[] = "Above";
    char haystack[] = "Beyond";

    char *result = strcasestr(haystack, needle);
    printf("%s\n", result);
}

---8<------8<------8<------8<------8<------8<------8<---

This was built as follows :-

[vic@perridge glibc_test]$ gcc -g -o test -Wall test.c 
test.c:9:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]

[I'm ignoring the warning - I don't care that main is void]

When run, we get the following :-

[vic@perridge glibc_test]$ ./test 
Segmentation fault (core dumped)

Looking through the code (I've just done this with 2.21, although I first found
it on 2.14), we find the following in critical_factorization:-

  max_suffix = SIZE_MAX;
  j = 0;
  k = p = 1;
  while (j + k < needle_len)
    {
      a = CANON_ELEMENT (needle[j + k]);
      b = CANON_ELEMENT (needle[max_suffix + k]);

SIZE_MAX is defined as 18446744073709551615UL on my 64-bit system (confirmed
with "gcc -E"); I believe this comes from stdint.h. Needless to say, the
needle[max_suffix + k] dereference will segfault when it is this size. And it
does.

I note that the Debian repository has replaced this method with something much
simpler (that doesn't segfault).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From glibc-bugs-return-28819-listarch-glibc-bugs=sources.redhat.com@sourceware.org Tue Jul 14 12:11:13 2015
Return-Path: <glibc-bugs-return-28819-listarch-glibc-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-glibc-bugs@sources.redhat.com
Received: (qmail 67325 invoked by alias); 14 Jul 2015 12:11:12 -0000
Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <glibc-bugs.sourceware.org>
List-Subscribe: <mailto:glibc-bugs-subscribe@sourceware.org>
List-Post: <mailto:glibc-bugs@sourceware.org>
List-Help: <mailto:glibc-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: glibc-bugs-owner@sourceware.org
Delivered-To: mailing list glibc-bugs@sourceware.org
Received: (qmail 67300 invoked by uid 48); 14 Jul 2015 12:11:08 -0000
From: "glibc at beer dot org.uk" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/18670] strcasestr and friends segfault
Date: Tue, 14 Jul 2015 12:11:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: glibc
X-Bugzilla-Component: libc
X-Bugzilla-Version: 2.21
X-Bugzilla-Keywords:
X-Bugzilla-Severity: critical
X-Bugzilla-Who: glibc at beer dot org.uk
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-18670-131-gR2S8aHSHT@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-18670-131@http.sourceware.org/bugzilla/>
References: <bug-18670-131@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg00099.txt.bz2
Content-length: 381

https://sourceware.org/bugzilla/show_bug.cgi?id\x18670

Vic <glibc at beer dot org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glibc at beer dot org.uk

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


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

* [Bug libc/18666] Add support for '%OY' in strftime(), currently only "%Oy" is supported
  2015-07-14  9:12 [Bug libc/18666] New: Add support for '%OY' in strftime(), currently only "%Oy" is supported sandeep.shedmake at gmail dot com
@ 2015-08-15 19:35 ` ppluzhnikov at google dot com
  2015-08-27 22:28 ` [Bug time/18666] " jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ppluzhnikov at google dot com @ 2015-08-15 19:35 UTC (permalink / raw)
  To: glibc-bugs

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

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppluzhnikov at google dot com

--- Comment #1 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
AFAICT the newest Single UNIX strftime spec
http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
explicitly mentions '%Oy' (and '%EY'), but not '%OY'.

Looks like a possible standard defect.

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


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

* [Bug time/18666] Add support for '%OY' in strftime(), currently only "%Oy" is supported
  2015-07-14  9:12 [Bug libc/18666] New: Add support for '%OY' in strftime(), currently only "%Oy" is supported sandeep.shedmake at gmail dot com
  2015-08-15 19:35 ` [Bug libc/18666] " ppluzhnikov at google dot com
@ 2015-08-27 22:28 ` jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-08-27 22:28 UTC (permalink / raw)
  To: glibc-bugs

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

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libc                        |time

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


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

end of thread, other threads:[~2015-08-27 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14  9:12 [Bug libc/18666] New: Add support for '%OY' in strftime(), currently only "%Oy" is supported sandeep.shedmake at gmail dot com
2015-08-15 19:35 ` [Bug libc/18666] " ppluzhnikov at google dot com
2015-08-27 22:28 ` [Bug time/18666] " jsm28 at gcc dot gnu.org

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).