Fixed incorrect WAC decoding

Fixed the incorrect warning area coordinate decoding
when data length is greater than 127 bytes.

Bug: 143762197
Test: unit test
Change-Id: I498ccd0933f31898d531dcea307e160ae94653e8
This commit is contained in:
Jack Yu
2019-11-07 11:06:48 -08:00
parent cafc138898
commit 6586ad9e80

View File

@@ -214,7 +214,7 @@ public class GsmSmsCbMessage {
private static Pair<Integer, List<Geometry>> parseWarningAreaCoordinates(
byte[] pdu, int wacOffset) {
// little-endian
int wacDataLength = (pdu[wacOffset + 1] << 8) | pdu[wacOffset];
int wacDataLength = ((pdu[wacOffset + 1] & 0xff) << 8) | (pdu[wacOffset] & 0xff);
int offset = wacOffset + 2;
if (offset + wacDataLength > pdu.length) {