diff options
author | Xia Ying <yingxia@motorola.com> | 2014-07-28 13:46:28 -0500 |
---|---|---|
committer | Amit Mahajan <amitmahajan@google.com> | 2014-09-04 12:05:53 -0700 |
commit | 9bd196bb4252039be0d965545b816d1559e74ebd (patch) | |
tree | 44374744409154729eaff751a6c08c9d23e537df /telephony/java/com | |
parent | ac0d317c311a9f3e298f3e67cf3422bd8c419c17 (diff) | |
download | frameworks_base-9bd196bb4252039be0d965545b816d1559e74ebd.zip frameworks_base-9bd196bb4252039be0d965545b816d1559e74ebd.tar.gz frameworks_base-9bd196bb4252039be0d965545b816d1559e74ebd.tar.bz2 |
Fix the IndexOutOfBoundsException when unpacking GSM 8-bit pdu
Some wap push messages contains the charactors which are not in the
GSM 7 bit Default Alphabet table and its extension table, it cause the
IndexOutOfBoundsException when unpacking GSM 8-bit encoded pdu.
Solution: Replace them with white space.
Change-Id: I273953341cffddc2269332eabc556e303ff81bec
Diffstat (limited to 'telephony/java/com')
-rw-r--r-- | telephony/java/com/android/internal/telephony/GsmAlphabet.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/telephony/java/com/android/internal/telephony/GsmAlphabet.java b/telephony/java/com/android/internal/telephony/GsmAlphabet.java index 4cba70d..d1c8ef0 100644 --- a/telephony/java/com/android/internal/telephony/GsmAlphabet.java +++ b/telephony/java/com/android/internal/telephony/GsmAlphabet.java @@ -609,16 +609,25 @@ public class GsmAlphabet { } } else { if (prevWasEscape) { - char shiftChar = shiftTableToChar.charAt(c); + char shiftChar = + c < shiftTableToChar.length() ? shiftTableToChar.charAt(c) : ' '; if (shiftChar == ' ') { // display character from main table if not present in shift table - ret.append(languageTableToChar.charAt(c)); + if (c < languageTableToChar.length()) { + ret.append(languageTableToChar.charAt(c)); + } else { + ret.append(' '); + } } else { ret.append(shiftChar); } } else { if (!isMbcs || c < 0x80 || i + 1 >= offset + length) { - ret.append(languageTableToChar.charAt(c)); + if (c < languageTableToChar.length()) { + ret.append(languageTableToChar.charAt(c)); + } else { + ret.append(' '); + } } else { // isMbcs must be true. So both mbcsBuffer and charset are initialized. mbcsBuffer.clear(); |