bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Invalid gettext preprocessing causes broken format strings and sigsegv a


From: Zygmunt Krynicki
Subject: Invalid gettext preprocessing causes broken format strings and sigsegv at runtine
Date: Wed, 19 Jul 2006 14:43:31 +0200

Preprocessing of macro PRIuMAX is not forwarded to gettext and produces
broken format strings.

Example code: printf (gettext("Foo: " PRIuMAX " %s\n"),
(uintmax_t)12345, "");

Example ltrace of dd session with LANG=C and LANG=pl_PL.UTF-8 are pasted
below:

(C):

__libc_start_main(0x804afcc, 5, 0xbfade324, 0x804eeb8, 0x804ef09
<unfinished ...>
setlocale(6, "")                                 = "C"
bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale"
textdomain("coreutils")                          = "coreutils"
__cxa_atexit(0x804c3ad, 0, 0, 0xbfade324, 0xbfade298) = 0
getpagesize()                                    = 4096
getopt_long(5, 0xbfade324, "", NULL, NULL)       = -1
strchr("if=/dev/zero", '=')                      = "=/dev/zero"
strchr("of=/dev/null", '=')                      = "=/dev/null"
strchr("bs=12500", '=')                          = "=12500"
__ctype_b_loc()                                  = 0xb7e706a4
__errno_location()                               = 0xb7e706a0
__strtoull_internal(0xbfadf880, 0xbfade104, 10, 0, 0xbfade09c) = 12500
strchr("count=1", '=')                           = "=1"
__ctype_b_loc()                                  = 0xb7e706a4
__errno_location()                               = 0xb7e706a0
__strtoull_internal(0xbfadf88c, 0xbfade104, 10, 0, 0xbfade09c) = 1
close(0)                                         = 0
open64("/dev/zero", 0, 00)                       = 0
lseek64(0, 0, 0, 1, 0)                           = 0
__errno_location()                               = 0xb7e706a0
close(1)                                         = 0
open64("/dev/null", 577, 0666)                   = 1
getenv("POSIXLY_CORRECT")                        = NULL
sigemptyset(0x8051420)                           = 0
sigaction(10, NULL, 0xbfade198)                  = 0
sigaddset(0x8051420, 10)                         = 0
sigaction(2, NULL, 0xbfade198)                   = 0
sigaddset(0x8051420, 2)                          = 0
memcpy(0xbfade19c, "\002\002", 128)              = 0xbfade19c
sigismember(0x8051420, 10)                       = 1
sigaction(10, 0xbfade198, NULL)                  = 0
sigismember(0x8051420, 2)                        = 1
sigaction(2, 0xbfade198, NULL)                   = 0
clock_gettime(1, 0xbfade104, 0, 0, 0)            = 0
malloc(20695)                                    = 0x8052038
read(0, "", 12500)                               = 12500
write(1, "", 12500)                              = 12500
free(0x8052038)                                  = <void>
free(NULL)                                       = <void>
close(0)                                         = 0
close(1)                                         = 0
clock_gettime(1, 0xbfadde04, 0xb7fcad50, 0xb7e744dc, 1) = 0
dcgettext(0, 0x804ff44, 5, 0xb7e744dc, 0xbfadde4c) = 0x804ff44
fprintf(0xb7faef80, "%llu+%llu records in\n%llu+%llu "..., ...1+0
records in
1+0 records out
) = 31
localeconv(0xbfaddd84, 0xb7fcb158, 2, 0xb7e83368, 1) = 0xb7fafd20
dcngettext(0, 0x80501ec, 0x80501d5, 12500, 5)    = 0x80501d5
fprintf(0xb7faef80, "%llu bytes (%s) copied", ...12500 bytes (12 kB)
copied) = 26
localeconv(0xb7ea0043, 0xb7ea772c, 0xb7f9a15a, 0x8052028, 9) =
0xb7fafd20
sprintf("10.5", "%.1Lf", ...)                    = 4
memmove(0xbfade100, 0xbfadde7c, 4, 0xa87df37d, 16386) = 0xbfade100
dcngettext(0, 0x805021f, 0x805020b, 0, 5)        = 0x805020b
fprintf(0xb7faef80, ", %g seconds, %s/s\n", ..., 0.001187 seconds, 10.5
MB/s
) = 30
exit(0 <unfinished ...>
__fpending(0xb7faf0e0, 0xb7e83368, 1, 1, 0)      = 0
fclose(0xb7faf0e0)                               = -1
__errno_location()                               = 0xb7e706a0
+++ exited (status 0) +++


(PL)

__libc_start_main(0x804afcc, 5, 0xbf98ec84, 0x804eeb8, 0x804ef09
<unfinished ...>
setlocale(6, "")                                 = "pl_PL.UTF-8"
bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale"
textdomain("coreutils")                          = "coreutils"
__cxa_atexit(0x804c3ad, 0, 0, 0xbf98ec84, 0xbf98ebf8) = 0
getpagesize()                                    = 4096
getopt_long(5, 0xbf98ec84, "", NULL, NULL)       = -1
strchr("if=/dev/zero", '=')                      = "=/dev/zero"
strchr("of=/dev/null", '=')                      = "=/dev/null"
strchr("bs=12500", '=')                          = "=12500"
__ctype_b_loc()                                  = 0xb7e1f6a4
__errno_location()                               = 0xb7e1f6a0
__strtoull_internal(0xbf98f876, 0xbf98ea64, 10, 0, 0) = 12500
strchr("count=1", '=')                           = "=1"
__ctype_b_loc()                                  = 0xb7e1f6a4
__errno_location()                               = 0xb7e1f6a0
__strtoull_internal(0xbf98f882, 0xbf98ea64, 10, 0, 0) = 1
close(0)                                         = 0
open64("/dev/zero", 0, 00)                       = 0
lseek64(0, 0, 0, 1, 0)                           = 0
__errno_location()                               = 0xb7e1f6a0
close(1)                                         = 0
open64("/dev/null", 577, 0666)                   = 1
getenv("POSIXLY_CORRECT")                        = NULL
sigemptyset(0x8051420)                           = 0
sigaction(10, NULL, 0xbf98eaf8)                  = 0
sigaddset(0x8051420, 10)                         = 0
sigaction(2, NULL, 0xbf98eaf8)                   = 0
sigaddset(0x8051420, 2)                          = 0
memcpy(0xbf98eafc, "\002\002", 128)              = 0xbf98eafc
sigismember(0x8051420, 10)                       = 1
sigaction(10, 0xbf98eaf8, NULL)                  = 0
sigismember(0x8051420, 2)                        = 1
sigaction(2, 0xbf98eaf8, NULL)                   = 0
clock_gettime(1, 0xbf98ea64, 0, 0, 0)            = 0
malloc(20695)                                    = 0x806c580
read(0, "", 12500)                               = 12500
write(1, "", 12500)                              = 12500
free(0x806c580)                                  = <void>
free(NULL)                                       = <void>
close(0)                                         = 0
close(1)                                         = 0
clock_gettime(1, 0xbf98e764, 0xb7e58d61, 0x806c2c0, 0xb7f5f320) = 0
dcgettext(0, 0x804ff44, 5, -1, 0x806c0f0)        = 0x804ff44
fprintf(0xb7f5df80, "%llu+%llu records in\n%llu+%llu "..., ...1+0
records in
1+0 records out
) = 31
localeconv(0xbf98e6e4, 0xb7f7a158, 2, 0xb7e32368, 1) = 0xb7f5ed20
dcngettext(0, 0x80501ec, 0x80501d5, 12500, 5)    = 0xb7d095bd
fprintf(0xb7f5df80, "skopiowane %<PRIuMAX> bajt\303\263"..., 12500, NULL
<unfinished ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++


Regards
Zygmunt Krynicki









reply via email to

[Prev in Thread] Current Thread [Next in Thread]