diff options
author | Florian Weimer <fweimer@redhat.com> | 2024-09-20 13:10:54 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2024-09-20 13:51:09 +0200 |
commit | 6cbf845fcdc76131d0e674cee454fe738b69c69d (patch) | |
tree | 0287a704e978c0178178ca4521dd10e8cf6be87a /iconvdata | |
parent | 00ba299787c2ea9e5c4986301e2f4965dffbfded (diff) | |
download | glibc-6cbf845fcdc76131d0e674cee454fe738b69c69d.tar.gz glibc-6cbf845fcdc76131d0e674cee454fe738b69c69d.tar.xz glibc-6cbf845fcdc76131d0e674cee454fe738b69c69d.zip |
iconv: Preserve iconv -c error exit on invalid inputs (bug 32046)
In several converters, a __GCONV_ILLEGAL_INPUT result gets overwritten with __GCONV_FULL_OUTPUT. As a result, iconv (the function) returns E2BIG instead of EILSEQ. The iconv program does not see the original EILSEQ failure, does not recognize the invalid input, and may incorrectly exit successfully. To address this, a new __flags bit is used to indicate a sticky input error state. All __GCONV_ILLEGAL_INPUT results are replaced with a function call that sets this new __GCONV_ENCOUNTERED_ILLEGAL_INPUT and returns __GCONV_ILLEGAL_INPUT. The iconv program checks for __GCONV_ENCOUNTERED_ILLEGAL_INPUT and overrides the exit status. The converter changes introducing __gconv_mark_illegal_input are mostly mechanical, except for the res variable initialization in iconvdata/iso-2022-jp.c: this error gets overwritten with __GCONV_OK and other results in the following code. If res == __GCONV_ILLEGAL_INPUT afterwards, STANDARD_TO_LOOP_ERR_HANDLER below will handle it. The __gconv_mark_illegal_input changes do not alter the errno value set by the iconv function. This is simpler to implement than reviewing each __GCONV_FULL_OUTPUT result and adjust it not to override a previous __GCONV_ILLEGAL_INPUT result. Doing it that way would also change some E2BIG errors in to EILSEQ errors, so it had to be done conditionally (under a flag set by the iconv program only), to avoid confusing buffer management in other applications. Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'iconvdata')
-rw-r--r-- | iconvdata/cp932.c | 6 | ||||
-rw-r--r-- | iconvdata/euc-jp-ms.c | 8 | ||||
-rw-r--r-- | iconvdata/gbbig5.c | 4 | ||||
-rw-r--r-- | iconvdata/ibm1364.c | 8 | ||||
-rw-r--r-- | iconvdata/iso646.c | 154 | ||||
-rw-r--r-- | iconvdata/unicode.c | 2 | ||||
-rw-r--r-- | iconvdata/utf-16.c | 2 | ||||
-rw-r--r-- | iconvdata/utf-32.c | 2 |
8 files changed, 93 insertions, 93 deletions
diff --git a/iconvdata/cp932.c b/iconvdata/cp932.c index bf7297b114..3def70a70b 100644 --- a/iconvdata/cp932.c +++ b/iconvdata/cp932.c @@ -4559,7 +4559,7 @@ static const char from_ucs4_extra[229][2] = if (! ignore_errors_p ()) \ { \ /* This is an illegal character. */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ \ @@ -4599,7 +4599,7 @@ static const char from_ucs4_extra[229][2] = if (! ignore_errors_p ()) \ { \ /* This is an illegal character. */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ \ @@ -4634,7 +4634,7 @@ static const char from_ucs4_extra[229][2] = if (! ignore_errors_p ()) \ { \ /* This is an illegal character. */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ \ diff --git a/iconvdata/euc-jp-ms.c b/iconvdata/euc-jp-ms.c index d03a0e05bb..96c5325e9d 100644 --- a/iconvdata/euc-jp-ms.c +++ b/iconvdata/euc-jp-ms.c @@ -4659,7 +4659,7 @@ static const unsigned char from_ucs4_extra[229][2] = /* This is illegal. */ \ if (! ignore_errors_p ()) \ { \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ \ @@ -4689,7 +4689,7 @@ static const unsigned char from_ucs4_extra[229][2] = /* This is an illegal character. */ \ if (! ignore_errors_p ()) \ { \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ \ @@ -4709,7 +4709,7 @@ static const unsigned char from_ucs4_extra[229][2] = if (! ignore_errors_p ()) \ { \ /* This is an illegal character. */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ } \ @@ -4820,7 +4820,7 @@ static const unsigned char from_ucs4_extra[229][2] = if (! ignore_errors_p ()) \ { \ /* This is an illegal character. */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ \ diff --git a/iconvdata/gbbig5.c b/iconvdata/gbbig5.c index f05deeeb1a..b15a2ef932 100644 --- a/iconvdata/gbbig5.c +++ b/iconvdata/gbbig5.c @@ -4831,7 +4831,7 @@ const char __from_big5_to_gb2312 [13973][2] = { \ /* We do not have a mapping for this character. \ If ignore errors, map it to 0xa1bc - big5 box character */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ if (! ignore_errors_p ()) \ break; \ \ @@ -4922,7 +4922,7 @@ const char __from_big5_to_gb2312 [13973][2] = { \ /* We do not have a mapping for this character. \ If ignore errors, map it to 0xa1f5 - gb box character */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ if (! ignore_errors_p ()) \ break; \ \ diff --git a/iconvdata/ibm1364.c b/iconvdata/ibm1364.c index 4c37f30e98..d6c8ce7f68 100644 --- a/iconvdata/ibm1364.c +++ b/iconvdata/ibm1364.c @@ -179,7 +179,7 @@ enum /* This is an illegal character. */ \ if (! ignore_errors_p ()) \ { \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ ++*irreversible; \ @@ -219,7 +219,7 @@ enum /* This is an illegal character. */ \ if (! ignore_errors_p ()) \ { \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ ++*irreversible; \ @@ -300,7 +300,7 @@ enum \ if (! ignore_errors_p ()) \ { \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ ++*irreversible; \ @@ -332,7 +332,7 @@ enum /* This is an illegal character. */ \ if (! ignore_errors_p ()) \ { \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ break; \ } \ ++*irreversible; \ diff --git a/iconvdata/iso646.c b/iconvdata/iso646.c index d96e5f86b9..ba7e23f8ac 100644 --- a/iconvdata/iso646.c +++ b/iconvdata/iso646.c @@ -313,7 +313,7 @@ gconv_end (struct __gconv_step *data) ch = 0xf9; \ else if (var == JP_OCR_B) \ /* Illegal character. */ \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ else if (var == YU) \ ch = 0x17e; \ else if (var == HU) \ @@ -387,7 +387,7 @@ gconv_end (struct __gconv_step *data) ch = 0xec; \ else if (var == JP_OCR_B) \ /* Illegal character. */ \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ else if (var == YU) \ ch = 0x10d; \ else if (var == HU) \ @@ -403,7 +403,7 @@ gconv_end (struct __gconv_step *data) break; \ case 0x80 ... 0xff: \ /* Illegal character. */ \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ } \ \ @@ -440,17 +440,17 @@ gconv_end (struct __gconv_step *data) case 0x23: \ if (var == GB || var == ES || var == IT || var == FR || var == FR1 \ || var == NO2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x24: \ if (var == CN || var == HU || var == CU || var == SE || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x40: \ if (var == CA || var == CA2 || var == DE || var == ES || var == ES2 \ || var == IT || var == YU || var == HU || var == FR || var == FR1 \ || var == PT || var == PT2 || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x5b: \ if (var == CA || var == CA2 || var == DE || var == DK || var == ES \ @@ -458,7 +458,7 @@ gconv_end (struct __gconv_step *data) || var == HU || var == FR || var == FR1 || var == NO \ || var == NO2 || var == PT || var == PT2 || var == SE \ || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ else if (var == CU) \ ch = 0x7d; \ break; \ @@ -468,7 +468,7 @@ gconv_end (struct __gconv_step *data) || var == YU || var == KR || var == HU || var == CU || var == FR \ || var == FR1 || var == NO || var == NO2 || var == PT \ || var == PT2 || var == SE || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x5d: \ if (var == CA || var == CA2 || var == DE || var == DK || var == ES \ @@ -476,17 +476,17 @@ gconv_end (struct __gconv_step *data) || var == HU || var == FR || var == FR1 || var == NO \ || var == NO2 || var == PT || var == PT2 || var == SE \ || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x5e: \ if (var == CA || var == CA2 || var == ES2 || var == YU || var == CU \ || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x60: \ if (var == CA || var == CA2 || var == IT || var == JP_OCR_B \ || var == YU || var == HU || var == FR || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x7b: \ if (var == CA || var == CA2 || var == DE || var == DK || var == ES \ @@ -494,14 +494,14 @@ gconv_end (struct __gconv_step *data) || var == CU || var == FR || var == FR1 || var == NO \ || var == NO2 || var == PT || var == PT2 || var == SE \ || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x7c: \ if (var == CA || var == CA2 || var == DE || var == DK || var == ES \ || var == ES2 || var == IT || var == YU || var == HU || var == CU \ || var == FR || var == FR1 || var == NO || var == PT \ || var == PT2 || var == SE || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ else if (var == NO2) \ ch = 0x7e; \ break; \ @@ -510,7 +510,7 @@ gconv_end (struct __gconv_step *data) || var == ES2 || var == IT || var == YU || var == HU || var == CU \ || var == FR || var == FR1 || var == NO || var == NO2 \ || var == PT || var == PT2 || var == SE || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x7e: \ if (var == GB || var == CA || var == CA2 || var == DE || var == ES2 \ @@ -518,21 +518,21 @@ gconv_end (struct __gconv_step *data) || var == YU || var == HU || var == CU || var == FR || var == FR1 \ || var == NO || var == NO2 || var == PT || var == SE \ || var == SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xa1: \ if (var != ES && var != ES2 && var != CU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5b; \ break; \ case 0xa3: \ if (var != GB && var != ES && var != IT && var != FR && var != FR1) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x23; \ break; \ case 0xa4: \ if (var != HU && var != CU && var != SE && var != SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x24; \ break; \ case 0xa5: \ @@ -541,7 +541,7 @@ gconv_end (struct __gconv_step *data) else if (var == JP || var == JP_OCR_B) \ ch = 0x5c; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xa7: \ if (var == DE || var == ES || var == IT || var == PT) \ @@ -551,11 +551,11 @@ gconv_end (struct __gconv_step *data) else if (var == NO2) \ ch = 0x23; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xa8: \ if (var != ES2 && var != CU && var != FR && var != FR1) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7e; \ break; \ case 0xb0: \ @@ -566,7 +566,7 @@ gconv_end (struct __gconv_step *data) else if (var == PT) \ ch = 0x7e; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xb4: \ if (var == ES2 || var == CU) \ @@ -574,11 +574,11 @@ gconv_end (struct __gconv_step *data) else if (var == PT2) \ ch = 0x40; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xb5: \ if (var != FR) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x60; \ break; \ case 0xbf: \ @@ -587,31 +587,31 @@ gconv_end (struct __gconv_step *data) else if (var == ES2 || var == CU) \ ch = 0x5e; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xc1: \ if (var != HU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x40; \ break; \ case 0xc3: \ if (var != PT && var != PT2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5b; \ break; \ case 0xc4: \ if (var != DE && var != SE && var != SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5b; \ break; \ case 0xc5: \ if (var != DK && var != NO && var != NO2 && var != SE && var != SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5d; \ break; \ case 0xc6: \ if (var != DK && var != NO && var != NO2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5b; \ break; \ case 0xc7: \ @@ -620,7 +620,7 @@ gconv_end (struct __gconv_step *data) else if (var == PT || var == PT2) \ ch = 0x5c; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xc9: \ if (var == CA2) \ @@ -630,26 +630,26 @@ gconv_end (struct __gconv_step *data) else if (var == SE2) \ ch = 0x40; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xd1: \ if (var != ES && var != ES2 && var != CU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5c; \ break; \ case 0xd5: \ if (var != PT && var != PT2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5d; \ break; \ case 0xd6: \ if (var != DE && var != HU && var != SE && var != SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5c; \ break; \ case 0xd8: \ if (var != DK && var != NO && var != NO2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5c; \ break; \ case 0xdc: \ @@ -658,11 +658,11 @@ gconv_end (struct __gconv_step *data) else if (var == SE2) \ ch = 0x5e; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xdf: \ if (var != DE) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7e; \ break; \ case 0xe0: \ @@ -671,36 +671,36 @@ gconv_end (struct __gconv_step *data) else if (var == IT) \ ch = 0x7b; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xe1: \ if (var != HU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x60; \ break; \ case 0xe2: \ if (var != CA && var != CA2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5b; \ break; \ case 0xe3: \ if (var != PT && var != PT2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7b; \ break; \ case 0xe4: \ if (var != DE && var != SE && var != SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7b; \ break; \ case 0xe5: \ if (var != DK && var != NO && var != NO2 && var != SE && var != SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7d; \ break; \ case 0xe6: \ if (var != DK && var != NO && var != NO2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7b; \ break; \ case 0xe7: \ @@ -711,11 +711,11 @@ gconv_end (struct __gconv_step *data) else if (var == PT || var == PT2) \ ch = 0x7c; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xe8: \ if (var != CA && var != CA2 && var != IT && var != FR && var != FR1) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7d; \ break; \ case 0xe9: \ @@ -726,51 +726,51 @@ gconv_end (struct __gconv_step *data) else if (var == SE2) \ ch = 0x60; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xea: \ if (var != CA && var != CA2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5d; \ break; \ case 0xec: \ if (var != IT) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7e; \ break; \ case 0xee: \ if (var != CA) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5e; \ break; \ case 0xf1: \ if (var != ES && var != ES2 && var != CU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7c; \ break; \ case 0xf2: \ if (var != IT) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7c; \ break; \ case 0xf4: \ if (var != CA && var != CA2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x60; \ break; \ case 0xf5: \ if (var != PT && var != PT2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7d; \ break; \ case 0xf6: \ if (var != DE && var != HU && var != SE && var != SE2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7c; \ break; \ case 0xf8: \ if (var != DK && var != NO && var != NO2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7c; \ break; \ case 0xf9: \ @@ -779,11 +779,11 @@ gconv_end (struct __gconv_step *data) else if (var == IT) \ ch = 0x60; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0xfb: \ if (var != CA && var != CA2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7e; \ break; \ case 0xfc: \ @@ -792,93 +792,93 @@ gconv_end (struct __gconv_step *data) else if (var == SE2) \ ch = 0x7e; \ else \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ break; \ case 0x160: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5b; \ break; \ case 0x106: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5d; \ break; \ case 0x107: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7d; \ break; \ case 0x10c: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5e; \ break; \ case 0x10d: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7e; \ break; \ case 0x110: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5c; \ break; \ case 0x111: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7c; \ break; \ case 0x161: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7b; \ break; \ case 0x17d: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x40; \ break; \ case 0x17e: \ if (var != YU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x60; \ break; \ case 0x2dd: \ if (var != HU) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7e; \ break; \ case 0x2022: \ if (var != ES2) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x40; \ break; \ case 0x203e: \ if (var != GB && var != CN && var != JP && var != NO && var != SE) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x7e; \ break; \ case 0x20a9: \ if (var != KR) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5c; \ break; \ case 0x2329: \ if (var != JP_OCR_B) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5b; \ break; \ case 0x232a: \ if (var != JP_OCR_B) \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ ch = 0x5d; \ break; \ default: \ if (__glibc_unlikely (ch > 0x7f)) \ { \ UNICODE_TAG_HANDLER (ch, 4); \ - failure = __GCONV_ILLEGAL_INPUT; \ + failure = __gconv_mark_illegal_input (step_data); \ } \ break; \ } \ diff --git a/iconvdata/unicode.c b/iconvdata/unicode.c index d69c9887a1..79bb9886e5 100644 --- a/iconvdata/unicode.c +++ b/iconvdata/unicode.c @@ -163,7 +163,7 @@ gconv_end (struct __gconv_step *data) surrogates pass through, attackers could make a security \ hole exploit by synthesizing any desired plane 1-16 \ character. */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ if (! ignore_errors_p ()) \ break; \ inptr += 4; \ diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c index a869353f20..9d9fd2a2a3 100644 --- a/iconvdata/utf-16.c +++ b/iconvdata/utf-16.c @@ -206,7 +206,7 @@ gconv_end (struct __gconv_step *data) We must catch this. If we let surrogates pass through, \ attackers could make a security hole exploit by \ synthesizing any desired plane 1-16 character. */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ if (! ignore_errors_p ()) \ break; \ inptr += 4; \ diff --git a/iconvdata/utf-32.c b/iconvdata/utf-32.c index 5693b48975..139eefb6d8 100644 --- a/iconvdata/utf-32.c +++ b/iconvdata/utf-32.c @@ -207,7 +207,7 @@ gconv_end (struct __gconv_step *data) We must catch this. If we let surrogates pass through, \ attackers could make a security hole exploit by \ generating "irregular UTF-32" sequences. */ \ - result = __GCONV_ILLEGAL_INPUT; \ + result = __gconv_mark_illegal_input (step_data); \ if (! ignore_errors_p ()) \ break; \ inptr += 4; \ |