appium-ios-remotexpc 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/build/src/lib/plist/binary-plist-creator.d.ts.map +1 -1
- package/build/src/lib/plist/binary-plist-creator.js +17 -5
- package/build/src/lib/plist/binary-plist-parser.d.ts.map +1 -1
- package/build/src/lib/plist/binary-plist-parser.js +19 -9
- package/package.json +1 -1
- package/src/lib/plist/binary-plist-creator.ts +20 -5
- package/src/lib/plist/binary-plist-parser.ts +22 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [0.3.3](https://github.com/appium/appium-ios-remotexpc/compare/v0.3.2...v0.3.3) (2025-09-05)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* correct UTF-16BE string parsing and TempObject handling in binary plist parser ([#65](https://github.com/appium/appium-ios-remotexpc/issues/65)) ([e64933a](https://github.com/appium/appium-ios-remotexpc/commit/e64933a5126ea796b12fcd001d12cab93a3bb9f8))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* **deps:** bump actions/checkout from 4 to 5 ([#64](https://github.com/appium/appium-ios-remotexpc/issues/64)) ([2fc7af0](https://github.com/appium/appium-ios-remotexpc/commit/2fc7af0c29f774f4dc37339c0825b109d410b815))
|
|
10
|
+
|
|
1
11
|
## [0.3.2](https://github.com/appium/appium-ios-remotexpc/compare/v0.3.1...v0.3.2) (2025-08-31)
|
|
2
12
|
|
|
3
13
|
### Miscellaneous Chores
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-plist-creator.d.ts","sourceRoot":"","sources":["../../../../src/lib/plist/binary-plist-creator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"binary-plist-creator.d.ts","sourceRoot":"","sources":["../../../../src/lib/plist/binary-plist-creator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,aAAa,CAAC;AA2jB/D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAGzD"}
|
|
@@ -39,7 +39,9 @@ class BinaryPlistCreator {
|
|
|
39
39
|
const objectOffsets = [];
|
|
40
40
|
const objectData = [];
|
|
41
41
|
for (const value of this._objectTable) {
|
|
42
|
-
|
|
42
|
+
// Calculate offset including the header length
|
|
43
|
+
objectOffsets.push(BPLIST_MAGIC_AND_VERSION.length +
|
|
44
|
+
this._calculateObjectDataLength(objectData));
|
|
43
45
|
objectData.push(this._createObjectData(value));
|
|
44
46
|
}
|
|
45
47
|
// Calculate offset table size
|
|
@@ -291,10 +293,20 @@ class BinaryPlistCreator {
|
|
|
291
293
|
// Check if string can be ASCII
|
|
292
294
|
// eslint-disable-next-line no-control-regex
|
|
293
295
|
const isAscii = /^[\x00-\x7F]*$/.test(value);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
let stringBuffer;
|
|
297
|
+
if (isAscii) {
|
|
298
|
+
stringBuffer = Buffer.from(value, 'ascii');
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
// Unicode strings should be stored as UTF-16BE in binary plists
|
|
302
|
+
const utf16leBuffer = Buffer.from(value, 'utf16le');
|
|
303
|
+
stringBuffer = Buffer.alloc(utf16leBuffer.length);
|
|
304
|
+
// Convert UTF-16LE to UTF-16BE
|
|
305
|
+
for (let i = 0; i < utf16leBuffer.length; i += 2) {
|
|
306
|
+
stringBuffer[i] = utf16leBuffer[i + 1]; // High byte
|
|
307
|
+
stringBuffer[i + 1] = utf16leBuffer[i]; // Low byte
|
|
308
|
+
}
|
|
309
|
+
}
|
|
298
310
|
const length = isAscii ? value.length : stringBuffer.length / 2;
|
|
299
311
|
let header;
|
|
300
312
|
if (length < 15) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-plist-parser.d.ts","sourceRoot":"","sources":["../../../../src/lib/plist/binary-plist-parser.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAA+B,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"binary-plist-parser.d.ts","sourceRoot":"","sources":["../../../../src/lib/plist/binary-plist-parser.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAA+B,UAAU,EAAE,MAAM,aAAa,CAAC;AAyjB3E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAG3D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIrD"}
|
|
@@ -200,12 +200,16 @@ class BinaryPlistParser {
|
|
|
200
200
|
* @returns The parsed string
|
|
201
201
|
*/
|
|
202
202
|
_parseUnicodeString(startOffset, objLength) {
|
|
203
|
-
// Unicode strings are stored as UTF-16BE
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
// Unicode strings are stored as UTF-16BE in binary plists
|
|
204
|
+
const bytesToRead = objLength * 2;
|
|
205
|
+
const stringBuffer = this._buffer.slice(startOffset, startOffset + bytesToRead);
|
|
206
|
+
// Convert UTF-16BE to UTF-16LE for proper decoding
|
|
207
|
+
const utf16leBuffer = Buffer.alloc(bytesToRead);
|
|
208
|
+
for (let i = 0; i < bytesToRead; i += 2) {
|
|
209
|
+
utf16leBuffer[i] = stringBuffer[i + 1]; // Low byte
|
|
210
|
+
utf16leBuffer[i + 1] = stringBuffer[i]; // High byte
|
|
207
211
|
}
|
|
208
|
-
return
|
|
212
|
+
return utf16leBuffer.toString('utf16le');
|
|
209
213
|
}
|
|
210
214
|
/**
|
|
211
215
|
* Parses a UID value from the buffer
|
|
@@ -358,8 +362,11 @@ class BinaryPlistParser {
|
|
|
358
362
|
for (let j = 0; j < obj.objLength; j++) {
|
|
359
363
|
const refIdx = this._readObjectRef(obj.startOffset + j * this._objectRefSize);
|
|
360
364
|
const refValue = this._objectTable[refIdx];
|
|
361
|
-
//
|
|
362
|
-
if (
|
|
365
|
+
// Handle TempObjects correctly - they should be resolved by the time we get here
|
|
366
|
+
if (this._isTempObject(refValue)) {
|
|
367
|
+
array.push(refValue.value);
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
363
370
|
array.push(refValue);
|
|
364
371
|
}
|
|
365
372
|
}
|
|
@@ -382,8 +389,11 @@ class BinaryPlistParser {
|
|
|
382
389
|
if (typeof key !== 'string') {
|
|
383
390
|
throw new TypeError(`Dictionary key must be a string, got ${typeof key}`);
|
|
384
391
|
}
|
|
385
|
-
//
|
|
386
|
-
if (
|
|
392
|
+
// Handle TempObjects correctly - they should be resolved by the time we get here
|
|
393
|
+
if (this._isTempObject(value)) {
|
|
394
|
+
dict[key] = value.value;
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
387
397
|
dict[key] = value;
|
|
388
398
|
}
|
|
389
399
|
}
|
package/package.json
CHANGED
|
@@ -59,7 +59,11 @@ class BinaryPlistCreator {
|
|
|
59
59
|
const objectData: Buffer[] = [];
|
|
60
60
|
|
|
61
61
|
for (const value of this._objectTable) {
|
|
62
|
-
|
|
62
|
+
// Calculate offset including the header length
|
|
63
|
+
objectOffsets.push(
|
|
64
|
+
BPLIST_MAGIC_AND_VERSION.length +
|
|
65
|
+
this._calculateObjectDataLength(objectData),
|
|
66
|
+
);
|
|
63
67
|
objectData.push(this._createObjectData(value));
|
|
64
68
|
}
|
|
65
69
|
|
|
@@ -341,11 +345,22 @@ class BinaryPlistCreator {
|
|
|
341
345
|
// Check if string can be ASCII
|
|
342
346
|
// eslint-disable-next-line no-control-regex
|
|
343
347
|
const isAscii = /^[\x00-\x7F]*$/.test(value);
|
|
344
|
-
const stringBuffer = isAscii
|
|
345
|
-
? Buffer.from(value, 'ascii')
|
|
346
|
-
: Buffer.from(value, 'utf16le');
|
|
347
348
|
|
|
348
|
-
|
|
349
|
+
let stringBuffer: Buffer;
|
|
350
|
+
if (isAscii) {
|
|
351
|
+
stringBuffer = Buffer.from(value, 'ascii');
|
|
352
|
+
} else {
|
|
353
|
+
// Unicode strings should be stored as UTF-16BE in binary plists
|
|
354
|
+
const utf16leBuffer = Buffer.from(value, 'utf16le');
|
|
355
|
+
stringBuffer = Buffer.alloc(utf16leBuffer.length);
|
|
356
|
+
|
|
357
|
+
// Convert UTF-16LE to UTF-16BE
|
|
358
|
+
for (let i = 0; i < utf16leBuffer.length; i += 2) {
|
|
359
|
+
stringBuffer[i] = utf16leBuffer[i + 1]; // High byte
|
|
360
|
+
stringBuffer[i + 1] = utf16leBuffer[i]; // Low byte
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
349
364
|
const length = isAscii ? value.length : stringBuffer.length / 2;
|
|
350
365
|
let header: Buffer;
|
|
351
366
|
|
|
@@ -270,15 +270,21 @@ class BinaryPlistParser {
|
|
|
270
270
|
* @returns The parsed string
|
|
271
271
|
*/
|
|
272
272
|
private _parseUnicodeString(startOffset: number, objLength: number): string {
|
|
273
|
-
// Unicode strings are stored as UTF-16BE
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
273
|
+
// Unicode strings are stored as UTF-16BE in binary plists
|
|
274
|
+
const bytesToRead = objLength * 2;
|
|
275
|
+
const stringBuffer = this._buffer.slice(
|
|
276
|
+
startOffset,
|
|
277
|
+
startOffset + bytesToRead,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
// Convert UTF-16BE to UTF-16LE for proper decoding
|
|
281
|
+
const utf16leBuffer = Buffer.alloc(bytesToRead);
|
|
282
|
+
for (let i = 0; i < bytesToRead; i += 2) {
|
|
283
|
+
utf16leBuffer[i] = stringBuffer[i + 1]; // Low byte
|
|
284
|
+
utf16leBuffer[i + 1] = stringBuffer[i]; // High byte
|
|
280
285
|
}
|
|
281
|
-
|
|
286
|
+
|
|
287
|
+
return utf16leBuffer.toString('utf16le');
|
|
282
288
|
}
|
|
283
289
|
|
|
284
290
|
/**
|
|
@@ -476,8 +482,10 @@ class BinaryPlistParser {
|
|
|
476
482
|
obj.startOffset + j * this._objectRefSize,
|
|
477
483
|
);
|
|
478
484
|
const refValue = this._objectTable[refIdx];
|
|
479
|
-
//
|
|
480
|
-
if (
|
|
485
|
+
// Handle TempObjects correctly - they should be resolved by the time we get here
|
|
486
|
+
if (this._isTempObject(refValue)) {
|
|
487
|
+
array.push(refValue.value);
|
|
488
|
+
} else {
|
|
481
489
|
array.push(refValue);
|
|
482
490
|
}
|
|
483
491
|
}
|
|
@@ -511,8 +519,10 @@ class BinaryPlistParser {
|
|
|
511
519
|
);
|
|
512
520
|
}
|
|
513
521
|
|
|
514
|
-
//
|
|
515
|
-
if (
|
|
522
|
+
// Handle TempObjects correctly - they should be resolved by the time we get here
|
|
523
|
+
if (this._isTempObject(value)) {
|
|
524
|
+
dict[key] = value.value;
|
|
525
|
+
} else {
|
|
516
526
|
dict[key] = value;
|
|
517
527
|
}
|
|
518
528
|
}
|