1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-02 14:02:17 -05:00

Fix range check for ISO-2022-JP stream.

Signed-off-by: HIRANO Takahito <hiranotaka@zng.info>
This commit is contained in:
HIRANO Takahito 2011-01-29 17:56:58 +00:00
parent e9cb07422b
commit 07814db9f4

View File

@ -60,7 +60,7 @@ class Iso2022JpToShiftJisInputStream extends InputStream
if (in1 == '\n' || in1 == '\r') if (in1 == '\n' || in1 == '\r')
charset = Charset.ASCII; charset = Charset.ASCII;
if (in1 < 0x21 || in1 >= 0x7e) if (in1 < 0x21 || in1 >= 0x7f)
return in1; return in1;
switch (charset) switch (charset)
@ -71,7 +71,7 @@ class Iso2022JpToShiftJisInputStream extends InputStream
return in1 + 0x80; return in1 + 0x80;
case JISX0208: case JISX0208:
int in2 = mIn.read(); int in2 = mIn.read();
if (in2 < 0x21 || in2 >= 0x7e) if (in2 < 0x21 || in2 >= 0x7f)
throw new MalformedInputException(0); throw new MalformedInputException(0);
int out1 = (in1 + 1) / 2 + (in1 < 0x5f ? 0x70 : 0xb0); int out1 = (in1 + 1) / 2 + (in1 < 0x5f ? 0x70 : 0xb0);