GNU bug report logs -
#22667
string->bytevector encoding error
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22667 in the body.
You can then email your comments to 22667 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#22667
; Package
guile
.
(Sun, 14 Feb 2016 22:19:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Josep Portella Florit <jpf <at> primfilat.com>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Sun, 14 Feb 2016 22:19:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
'string->bytevector' throws 'encoding-error' when the encoding is
"UTF-16" and the length of the string is greater than 128. The same
for the encoding "UTF-32" and a string of length greater than 64.
Tested on Guile 2.0.11 and 2.1.2 with the same result.
How to reproduce:
(use-modules (ice-9 iconv))
;; These expressions evaluate as expected:
(string->bytevector (make-string 128 #\A) "UTF-16")
;; => #vu8(254 255 0 65 0 65 ...)
(string->bytevector (make-string 64 #\A) "UTF-32")
;; => #vu8(0 0 254 255 0 0 0 65 0 0 0 65 ...)
;; These expressions throw 'encoding-error':
(string->bytevector (make-string 129 #\A) "UTF-16")
(string->bytevector (make-string 65 #\A) "UTF-32")
Information forwarded
to
bug-guile <at> gnu.org
:
bug#22667
; Package
guile
.
(Thu, 03 Mar 2016 17:57:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 22667 <at> debbugs.gnu.org (full text, mbox):
Josep Portella Florit <jpf <at> primfilat.com> writes:
> 'string->bytevector' throws 'encoding-error' when the encoding is
> "UTF-16" and the length of the string is greater than 128. The same
> for the encoding "UTF-32" and a string of length greater than 64.
>
> Tested on Guile 2.0.11 and 2.1.2 with the same result.
>
> How to reproduce:
>
> (use-modules (ice-9 iconv))
>
> ;; These expressions evaluate as expected:
> (string->bytevector (make-string 128 #\A) "UTF-16")
> ;; => #vu8(254 255 0 65 0 65 ...)
> (string->bytevector (make-string 64 #\A) "UTF-32")
> ;; => #vu8(0 0 254 255 0 0 0 65 0 0 0 65 ...)
>
> ;; These expressions throw 'encoding-error':
> (string->bytevector (make-string 129 #\A) "UTF-16")
> (string->bytevector (make-string 65 #\A) "UTF-32")
Thee bug is in 'display_string_using_iconv', introduced in commit
f4bc4e5934, which improperly assumes that a 256-byte buffer
(encoded_output) will be large enough to hold the results of converting
up to 256 bytes of UTF-8 (utf8_buf) to an arbitrary encoding using
'iconv'. When this assumption fails, the call to 'iconv' on line 997
done = iconv (id->output_cd, &input, &input_left,
&output, &output_left);
reports a failure due to the output buffer being too small, and the code
fails to handle this case.
To be continued...
Mark
Information forwarded
to
bug-guile <at> gnu.org
:
bug#22667
; Package
guile
.
(Mon, 20 Jun 2016 16:08:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 22667 <at> debbugs.gnu.org (full text, mbox):
On Sun 14 Feb 2016 23:18, Josep Portella Florit <jpf <at> primfilat.com> writes:
> 'string->bytevector' throws 'encoding-error' when the encoding is
> "UTF-16" and the length of the string is greater than 128. The same
> for the encoding "UTF-32" and a string of length greater than 64.
>
> Tested on Guile 2.0.11 and 2.1.2 with the same result.
>
> How to reproduce:
>
> (use-modules (ice-9 iconv))
>
> ;; These expressions evaluate as expected:
> (string->bytevector (make-string 128 #\A) "UTF-16")
> ;; => #vu8(254 255 0 65 0 65 ...)
> (string->bytevector (make-string 64 #\A) "UTF-32")
> ;; => #vu8(0 0 254 255 0 0 0 65 0 0 0 65 ...)
>
> ;; These expressions throw 'encoding-error':
> (string->bytevector (make-string 129 #\A) "UTF-16")
> (string->bytevector (make-string 65 #\A) "UTF-32")
For what it's worth, this appears to be fixed in 2.1.3. However we
should fix 2.0 as well.
Andy
Reply sent
to
Andy Wingo <wingo <at> pobox.com>
:
You have taken responsibility.
(Sun, 07 Aug 2016 21:26:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Josep Portella Florit <jpf <at> primfilat.com>
:
bug acknowledged by developer.
(Sun, 07 Aug 2016 21:26:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 22667-done <at> debbugs.gnu.org (full text, mbox):
Hi,
On Mon 20 Jun 2016 18:07, Andy Wingo <wingo <at> pobox.com> writes:
> On Sun 14 Feb 2016 23:18, Josep Portella Florit <jpf <at> primfilat.com> writes:
>
>> (use-modules (ice-9 iconv))
>> ;; These expressions throw 'encoding-error':
>> (string->bytevector (make-string 129 #\A) "UTF-16")
>> (string->bytevector (make-string 65 #\A) "UTF-32")
>
> For what it's worth, this appears to be fixed in 2.1.3. However we
> should fix 2.0 as well.
Fixed. Thanks for the report, and thanks to Mark for diagnosing the
problem.
Andy.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 05 Sep 2016 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 238 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.