bug-gnu-libiconv
[Top][All Lists]
Advanced

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

Re: [bug-gnu-libiconv] workaround for libiconv-1.11 tests failure on Sol


From: Bruno Haible
Subject: Re: [bug-gnu-libiconv] workaround for libiconv-1.11 tests failure on Solaris (Solaris printf bug)
Date: Tue, 24 Apr 2007 00:47:45 +0200
User-agent: KMail/1.5.4

Arto C. Nirkko <address@hidden> wrote:
> The libiconv-1.11 tests (gmake check) fail with Solaris in the
> test "tests/check-subst" on line 51 with the printf command
> because there seems to be a bug in Solaris /bin/printf (verified
> for Solaris 2.6, Solaris 8, Solaris 9), which makes it Segfault.
> 
> Workaround:
> instead of
> printf 'B<0x%010000x><0x%010000x>se B<0x%010000x><0x%010000x>bchen\n' 0xC3 
> 0xB6 0xC3 0xBC > tmp-ok
> 
> use:
> printf 'B<0x%09998x%02x><0x%09998x%02x>se 
> B<0x%09998x%02x><0x%09998x%02x>bchen\n' 0x00 0xC3 0x00 0xB6 0x00 0xC3 0x00 
> 0xBC > tmp-ok

Thanks for reporting this. According to the "truss" logs that I got,
it is a buffer overflow in /bin/printf, that would require 5 format
directives to produce a string of length 10000. But this would have an
impact on the maintainability of this test. So I prefer to simply skip
the test if the 'printf' command failed.

> Note that it doesn't seem to be a simple buffer overflow; for example
> <0x%05000x%05000x> crashes just as well as <0x%010000x>, whereas the
> above <0x%09998x%02x> works fine; it seems to depend on the number
> of trailing zeroes in the format???!!!

The effects of buffer overflows can be quite sensitive.

Bruno

2007-04-23  Bruno Haible  <address@hidden>

        * tests/check-subst: Use the output of 'printf' only if it didn't
        crash. Needed to work around a buffer overflow in Solaris /bin/printf.
        Reported by Arto C. Nirkko <address@hidden>.

*** tests/check-subst   31 Jul 2006 16:14:55 -0000      1.2
--- tests/check-subst   23 Apr 2007 22:43:01 -0000
***************
*** 51,58 ****
  Böse Bübchen
  EOF
  $iconv --byte-subst='<0x%010000x>' -f ASCII -t ASCII < tmp-in > tmp-out
! printf 'B<0x%010000x><0x%010000x>se B<0x%010000x><0x%010000x>bchen\n' 0xC3 
0xB6 0xC3 0xBC > tmp-ok
! cmp tmp-out tmp-ok
  
  # Test of --unicode-subst with an ASCII substitution.
  
--- 51,61 ----
  Böse Bübchen
  EOF
  $iconv --byte-subst='<0x%010000x>' -f ASCII -t ASCII < tmp-in > tmp-out
! printf 'B<0x%010000x><0x%010000x>se B<0x%010000x><0x%010000x>bchen\n' 0xC3 
0xB6 0xC3 0xBC > tmp-ok 2>/dev/null
! # This printf command crashes on Solaris 10.
! if test $? = 0; then
!   cmp tmp-out tmp-ok
! fi
  
  # Test of --unicode-subst with an ASCII substitution.
  
***************
*** 94,108 ****
  Böse Bübchen
  EOF
  $iconv --unicode-subst='<U+%010000X>' -f UTF-8 -t ASCII < tmp-in > tmp-out
! printf 'B<U+%010000X>se B<U+%010000X>bchen\n' 0x00F6 0x00FC > tmp-ok
! cmp tmp-out tmp-ok
  
  cat > tmp-in <<\EOF
  Böse Bübchen
  EOF
  $iconv --byte-subst='<0x%010000x>' -f ASCII -t ASCII < tmp-in > tmp-out
! printf 'B<0x%010000x><0x%010000x>se B<0x%010000x><0x%010000x>bchen\n' 0xC3 
0xB6 0xC3 0xBC > tmp-ok
! cmp tmp-out tmp-ok
  
  # Test of --widechar-subst:
  # wcrtomb() doesn't exist on FreeBSD 4.0 and is broken on MacOS X 10.3.
--- 97,117 ----
  Böse Bübchen
  EOF
  $iconv --unicode-subst='<U+%010000X>' -f UTF-8 -t ASCII < tmp-in > tmp-out
! printf 'B<U+%010000X>se B<U+%010000X>bchen\n' 0x00F6 0x00FC > tmp-ok 
2>/dev/null
! # This printf command crashes on Solaris 10.
! if test $? = 0; then
!   cmp tmp-out tmp-ok
! fi
  
  cat > tmp-in <<\EOF
  Böse Bübchen
  EOF
  $iconv --byte-subst='<0x%010000x>' -f ASCII -t ASCII < tmp-in > tmp-out
! printf 'B<0x%010000x><0x%010000x>se B<0x%010000x><0x%010000x>bchen\n' 0xC3 
0xB6 0xC3 0xBC > tmp-ok 2>/dev/null
! # This printf command crashes on Solaris 10.
! if test $? = 0; then
!   cmp tmp-out tmp-ok
! fi
  
  # Test of --widechar-subst:
  # wcrtomb() doesn't exist on FreeBSD 4.0 and is broken on MacOS X 10.3.





reply via email to

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