apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: [PATCH] fix apr_xlate_conv_buffer and testxlate
Date Thu, 18 Nov 2004 19:53:33 GMT
On Thu, Nov 18, 2004 at 05:22:50PM +0100, Uwe Zeisberger wrote:
> Hello,
> 
> I found a testxlate in the test dir of apr-util, which is not build and
> fails to correctly convert to UTF-7.
> 
> One reason is, that the trailing '\0' is translated to. An other is,
> that iconv cannot convert (in some cases) a buffer completly without
> knowing, that the string really ends at the end of inbuf. This only
> affects encodings, where in one (encoded) byte may be information for
> more then one decoded byte (i.e. UTF-7).
> 
> Below comes a log and a patch. I assume, that apr_xlate_conv_buffer
> should convert inbuf and assume, that the strings ends then. Else its
> use in test/testxlate.c is not appropriate.

Nice work, I'd noticed this failure before but not tracked it down. 
This looks like a real can of worms - I'm not sure it's necessarily
correct to assume that apr_xlate_conv_buffer() can behave like that. 
The fact that it returns APR_INCOMPLETE implies it is safe to use like
iconv() with multiple passes over a string, but it's not specifically
documented as such.

Subversion's use of the function does use multiple passes but always
passing the complete string as input, which seems redundant at least
with a real iconv() implementation.

Jeff or Branko, any comments?

joe

Mime
View raw message