Bug 1061535 - [B2G][RIL] relax restrictions on EF_IMG error handling - part 1 - fix. r=edgar

This commit is contained in:
Hsin-Yi Tsai 2014-09-03 15:53:09 +08:00
parent f7ac9d414d
commit eba9419907

View File

@ -13605,10 +13605,12 @@ SimRecordHelperObject.prototype = {
let numInstances = GsmPDUHelper.readHexOctet();
// Correct data length should be 9n+1 or 9n+2. See TS 31.102, sub-clause
// 4.6.1.1.
if (octetLen != (9 * numInstances + 1) ||
octetLen != (9 * numInstances + 2)) {
// Data length is defined as 9n+1 or 9n+2. See TS 31.102, sub-clause
// 4.6.1.1. However, it's likely to have padding appended so we have a
// rather loose check.
if (octetLen < (9 * numInstances + 1)) {
Buf.seekIncoming((octetLen - 1) * Buf.PDU_HEX_OCTET_SIZE);
Buf.readStringDelimiter(strLen);
if (onerror) {
onerror();
}
@ -13629,6 +13631,7 @@ SimRecordHelperObject.prototype = {
GsmPDUHelper.readHexOctet()
};
}
Buf.seekIncoming((octetLen - 9 * numInstances - 1) * Buf.PDU_HEX_OCTET_SIZE);
Buf.readStringDelimiter(strLen);
let instances = [];
@ -13688,6 +13691,8 @@ SimRecordHelperObject.prototype = {
if (octetLen < offset + dataLen) {
// Data length is not enough. See TS 31.102, clause 4.6.1.1, the
// paragraph "Bytes 8 and 9: Length of Image Instance Data."
Buf.seekIncoming(octetLen * Buf.PDU_HEX_OCTET_SIZE);
Buf.readStringDelimiter(strLen);
if (onerror) {
onerror();
}