diff options
author | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-21 17:09:57 +0000 |
---|---|---|
committer | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-21 17:09:57 +0000 |
commit | f7d803cb169339dbc614171dc94cd3b2cf65f633 (patch) | |
tree | 9f99e3eb63a9e63d6d4344ac6b38c0fc4b03a217 /libjava | |
parent | 6aaa1f9eb2f11b9afcc7c331b6b035013eca098a (diff) | |
download | gcc-f7d803cb169339dbc614171dc94cd3b2cf65f633.tar.gz |
PR libgcj/49314
* gnu/gcj/convert/natIconv.cc (iconv_init): Pad in[] with NUL byte.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175266 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/gnu/gcj/convert/natIconv.cc | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index c800bf3aac0..dfaa803c0a1 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2011-06-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR libgcj/49314 + * gnu/gcj/convert/natIconv.cc (iconv_init): Pad in[] with NUL byte. + 2011-06-17 Jack Howarth <howarth@bromo.med.uc.edu> PR target/49461 diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc index ad75a505ff8..8042ba86de0 100644 --- a/libjava/gnu/gcj/convert/natIconv.cc +++ b/libjava/gnu/gcj/convert/natIconv.cc @@ -1,6 +1,6 @@ // natIconv.cc -- Java side of iconv() reader. -/* Copyright (C) 2000, 2001, 2003, 2006 Free Software Foundation +/* Copyright (C) 2000, 2001, 2003, 2006, 2011 Free Software Foundation This file is part of libgcj. @@ -264,17 +264,19 @@ gnu::gcj::convert::IOConverter::iconv_init (void) if (handle != (iconv_t) -1) { jchar c; - unsigned char in[3]; + unsigned char in[4]; char *inp, *outp; size_t inc, outc, r; - // This is the UTF-8 encoding of \ufeff. + // This is the UTF-8 encoding of \ufeff. At least Tru64 UNIX libiconv + // needs the trailing NUL byte, otherwise iconv fails with EINVAL. in[0] = 0xef; in[1] = 0xbb; in[2] = 0xbf; + in[3] = 0x00; inp = (char *) in; - inc = 3; + inc = 4; outp = (char *) &c; outc = 2; |