unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Gracefully handle incompatible locale data
@ 2015-09-22 15:27 Ludovic Courtès
  2015-09-22 18:26 ` Roland McGrath
                   ` (4 more replies)
  0 siblings, 5 replies; 26+ messages in thread
From: Ludovic Courtès @ 2015-09-22 15:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: guix-devel

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

With libc 2.22 people are starting to realize that libc does not
guarantee that it can load locale data built with another libc version,
but they learn it the hard way:

  loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_COLLATE) / sizeof (_nl_value_type_LC_COLLATE[0]))' failed.

This patch changes such conditions to return EINVAL instead of aborting.

WDYT?

Thanks,
Ludo’.

2015-10-22  Ludovic Courtès  <ludo@gnu.org>

	* locale/loadlocale.c (_nl_intern_locale_data): Change assertion
	on CNT to a conditional jump to 'puntdata'.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 585 bytes --]

diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index fdba6e9..e04e720 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -122,8 +122,9 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
 	{
 #define CATTEST(cat)						\
 	case LC_##cat:						\
-	  assert (cnt < (sizeof (_nl_value_type_LC_##cat)		      \
-			 / sizeof (_nl_value_type_LC_##cat[0])));	      \
+	  if (cnt >= (sizeof (_nl_value_type_LC_##cat)		\
+		      / sizeof (_nl_value_type_LC_##cat[0])))	\
+	    goto puntdata;					\
 	  break
 	  CATTEST (NUMERIC);
 	  CATTEST (TIME);

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

end of thread, other threads:[~2015-10-28  6:19 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-22 15:27 [PATCH] Gracefully handle incompatible locale data Ludovic Courtès
2015-09-22 18:26 ` Roland McGrath
2015-09-22 19:18 ` Ondřej Bílka
2015-09-22 21:22   ` Ludovic Courtès
2015-09-22 21:50     ` Ondřej Bílka
2015-09-23 21:45       ` Ludovic Courtès
2015-09-24  8:27         ` Ondřej Bílka
2015-09-24 16:12           ` Ludovic Courtès
2015-09-25 21:20             ` Carlos O'Donell
2015-09-26 10:24               ` Ludovic Courtès
2015-09-28 20:54                 ` Carlos O'Donell
2015-09-29  8:08                   ` Ludovic Courtès
2015-10-08 10:31                     ` Ludovic Courtès
2015-10-13 13:30                     ` Carlos O'Donell
2015-10-13 14:45                       ` Ludovic Courtès
2015-10-28  5:38                         ` Carlos O'Donell
2015-10-13  0:49                   ` Allan McRae
2015-10-13  9:50                     ` Ludovic Courtès
2015-10-13 13:31                     ` Carlos O'Donell
2015-09-23  6:59 ` Andreas Schwab
2015-09-23  7:03   ` Andreas Schwab
2015-09-24  2:15 ` Mark H Weaver
2015-09-24 19:32   ` Ludovic Courtès
2015-10-27 15:30 ` Samuel Thibault
2015-10-27 15:57   ` Ludovic Courtès
2015-10-28  6:19   ` Carlos O'Donell

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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