public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix ld-time.c
@ 2006-05-11 15:04 Jakub Jelinek
  2006-05-11 16:48 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2006-05-11 15:04 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

wformat and wname fields are used in:
      iov[2 + cnt].iov_base = (void *) time->era_entries[num].wname;
      iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) time->era_entries[num].wformat, L'\0')
                               - (wchar_t *) time->era_entries[num].wname + 1)
                              * sizeof (uint32_t));
so, clearly neither should be NULL and both have to be in the same object.
The following patch attempts to do whatever we do for narrow name/format
(except the verbose warnings), i.e. if at least one of them is unspecified,
both are set to empty strings.

2006-05-11  Jakub Jelinek  <jakub@redhat.com>

	* locale/programs/ld-time.c (time_finish): If wide era name or
	format aren't provided, set both wname and wformat to L"".

--- libc/locale/programs/ld-time.c.jj	2006-05-10 14:03:49.000000000 +0200
+++ libc/locale/programs/ld-time.c	2006-05-11 16:50:11.000000000 +0200
@@ -467,15 +467,22 @@ No definition for %s category found"), "
 	  wstr = wstr ? wcschr (wstr + 1, L':') : NULL;	/* end offset */
 	  wstr = wstr ? wcschr (wstr + 1, L':') : NULL;	/* end start */
 	  wstr = wstr ? wcschr (wstr + 1, L':') : NULL;	/* end end */
-	  time->era_entries[idx].wname = (uint32_t *) wstr + 1;
 	  if (wstr != NULL)
 	    {
+	      time->era_entries[idx].wname = (uint32_t *) wstr + 1;
 	      wstr = wcschr (wstr + 1, L':');	/* end name */
-	      *wstr = L'\0';
-	      time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
+	      if (wstr != NULL)
+		{
+		  *wstr = L'\0';
+		  time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
+		}
+	      else
+		time->era_entries[idx].wname =
+		  time->era_entries[idx].wformat = (uint32_t *) L"";
 	    }
 	  else
-	    time->era_entries[idx].wformat = NULL;
+	    time->era_entries[idx].wname =
+	      time->era_entries[idx].wformat = (uint32_t *) L"";
 	}
     }
 

	Jakub

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

* Re: [PATCH] Fix ld-time.c
  2006-05-11 15:04 [PATCH] Fix ld-time.c Jakub Jelinek
@ 2006-05-11 16:48 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2006-05-11 16:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 101 bytes --]

Applied.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

end of thread, other threads:[~2006-05-11 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-11 15:04 [PATCH] Fix ld-time.c Jakub Jelinek
2006-05-11 16:48 ` Ulrich Drepper

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