Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f11b43d8 authored by Amit Mahajan's avatar Amit Mahajan Committed by Android (Google) Code Review
Browse files

Merge "Fix the IndexOutOfBoundsException when unpacking GSM 8-bit pdu" into lmp-dev

parents 8eca9e0f 9bd196bb
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -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
                        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) {
                        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();