Sean Owen 2021-09-02 09:27:41 -05:00
parent 6bcae2e5ea
commit 5b0036446e
2 changed files with 6 additions and 0 deletions

View file

@ -183,6 +183,9 @@ public final class Decoder {
eci = eci * 10 + (nextDigit - 2); eci = eci * 10 + (nextDigit - 2);
} }
CharacterSetECI charsetECI = CharacterSetECI.getCharacterSetECIByValue(eci); CharacterSetECI charsetECI = CharacterSetECI.getCharacterSetECIByValue(eci);
if (charsetECI == null) {
throw FormatException.getFormatInstance();
}
encoding = charsetECI.getCharset(); encoding = charsetECI.getCharset();
} }
// Go back to whatever mode we had been in // Go back to whatever mode we had been in

View file

@ -126,6 +126,9 @@ final class DecodedBitStreamParser {
case ECI_CHARSET: case ECI_CHARSET:
CharacterSetECI charsetECI = CharacterSetECI charsetECI =
CharacterSetECI.getCharacterSetECIByValue(codewords[codeIndex++]); CharacterSetECI.getCharacterSetECIByValue(codewords[codeIndex++]);
if (charsetECI == null) {
throw FormatException.getFormatInstance();
}
encoding = charsetECI.getCharset(); encoding = charsetECI.getCharset();
break; break;
case ECI_GENERAL_PURPOSE: case ECI_GENERAL_PURPOSE: