[PATCH] Correct the Big5-HKSCS converter to preserve low order state bits (bug 25744)

Tom Honermann tom@honermann.net
Tue Apr 7 05:40:49 GMT 2020


Enclosed is a patch for bug 25744 [1] that updates the Big5-HKSCS 
converter to properly maintain the lowest 3 bits of the mbstate_t 
__count data member.  This change is necessary to ensure that state is 
correctly preserved when the converter encounters an incomplete 
multibyte character.  More details are available in bug 25744 [1].

This patch depends on Carlos O'Donell's patch for bug 25734 [2] as 
posted at [3].

The code changes are styled to match how these bits are maintained by 
other converters such as iso-2022-jp.c, ibm930.c, and others.

Running 'grep __count' in the 'iconvdata' directory suggests that a 
number of other converters, euc-jisx0213.c for example, also fail to 
preserve these bits in some cases, though it may be that negative 
effects are not observed for those converters.  This patch does not 
attempt to address such issues with other converters.

Tested on Linux x86_64.

Carlos, assuming you have no objections to this patch, would you be so 
kind as to commit it on my behalf?  Thank you in advance.

ChangeLog:
	Correct Big5-HKSCS to preserve low order state bits (Bug 25744)

	* iconvdata/big5hkscs.c: Modified.
  	* iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c: Modified.

Tom.

[1]: https://sourceware.org/bugzilla/show_bug.cgi?id=25744
[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=25734
[3]: https://sourceware.org/pipermail/libc-alpha/2020-April/112551.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-25744.patch
Type: text/x-patch
Size: 5396 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200407/93115abc/attachment-0001.bin>


More information about the Libc-alpha mailing list