Rewrite get_iconv_codepoint to fix a bug involving byte-order marks.
authorMark H Weaver <mhw@netris.org>
Tue, 2 Apr 2013 21:26:37 +0000 (17:26 -0400)
committerMark H Weaver <mhw@netris.org>
Tue, 2 Apr 2013 21:45:50 +0000 (17:45 -0400)
commit1ee237d9a159e0e9a995ecb9fea24e1d39a7c5e1
treef01a0de68889f2c5ad5ccc42667caa07dcfeeaf7
parent8a2b596579185cd0f4d35da478f447e529d81a80
Rewrite get_iconv_codepoint to fix a bug involving byte-order marks.

* libguile/ports.c (get_iconv_codepoint): Rewrite to fix a bug and
  improve efficiency and clarity.  Previously, it incorrectly assumed
  that iconv would never consume input without producing output, which
  led to a buffer overrun and subsequent assertion failure.  This
  happens when a byte-order mark is consumed by iconv at the beginning
  of the stream when using the UTF-16 or UTF-32 encodings.

* test-suite/tests/ports.test (unicode byte-order marks (BOMs)):
  Add tests.
libguile/ports.c
test-suite/tests/ports.test