react-native-update-cli 2.28.3 → 2.29.0
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/lib/utils/hbcTransform.js +34 -23
- package/lib/utils/hermes-raw.js +21 -8
- package/package.json +1 -1
|
@@ -35,7 +35,30 @@ const HBC_HEADER_SIZE = 128;
|
|
|
35
35
|
const FUNC_OFFSET_25 = { byte: 0, bit: 0, bits: 25 };
|
|
36
36
|
const STRING_OFFSET_23 = { byte: 0, bit: 1, bits: 23 };
|
|
37
37
|
const PAIR_OFFSET_32 = { byte: 0, bit: 0, bits: 32 };
|
|
38
|
-
// v98
|
|
38
|
+
// 晚期 v98 与 v99 共用的头部计数字段
|
|
39
|
+
const V98_LATE_HEADER_FIELDS = [
|
|
40
|
+
'fileLength',
|
|
41
|
+
'globalCodeIndex',
|
|
42
|
+
'functionCount',
|
|
43
|
+
'stringKindCount',
|
|
44
|
+
'identifierCount',
|
|
45
|
+
'stringCount',
|
|
46
|
+
'overflowStringCount',
|
|
47
|
+
'stringStorageSize',
|
|
48
|
+
'bigIntCount',
|
|
49
|
+
'bigIntStorageSize',
|
|
50
|
+
'regExpCount',
|
|
51
|
+
'regExpStorageSize',
|
|
52
|
+
'literalValueBufferSize',
|
|
53
|
+
'objKeyBufferSize',
|
|
54
|
+
'objShapeTableCount',
|
|
55
|
+
'numStringSwitchImms',
|
|
56
|
+
'segmentID',
|
|
57
|
+
'cjsModuleCount',
|
|
58
|
+
'functionSourceCount',
|
|
59
|
+
'debugInfoOffset',
|
|
60
|
+
];
|
|
61
|
+
// v98 两种头部变体(及 v99)共享的段布局
|
|
39
62
|
const V98_SECTIONS = [
|
|
40
63
|
{
|
|
41
64
|
name: 'functionHeaders',
|
|
@@ -184,28 +207,16 @@ exports.HBC_LAYOUTS = [
|
|
|
184
207
|
// 段布局与早期 v98 相同。
|
|
185
208
|
minVersion: 98,
|
|
186
209
|
maxVersion: 98,
|
|
187
|
-
headerFields:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
'bigIntStorageSize',
|
|
198
|
-
'regExpCount',
|
|
199
|
-
'regExpStorageSize',
|
|
200
|
-
'literalValueBufferSize',
|
|
201
|
-
'objKeyBufferSize',
|
|
202
|
-
'objShapeTableCount',
|
|
203
|
-
'numStringSwitchImms',
|
|
204
|
-
'segmentID',
|
|
205
|
-
'cjsModuleCount',
|
|
206
|
-
'functionSourceCount',
|
|
207
|
-
'debugInfoOffset',
|
|
208
|
-
],
|
|
210
|
+
headerFields: V98_LATE_HEADER_FIELDS,
|
|
211
|
+
sections: V98_SECTIONS,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
// Hermes V1 v99(hermes-compiler 260318099,RN 0.88+):文件头与段布局
|
|
215
|
+
// 同晚期 v98,只改了函数头内部位域(去 NumCacheNewObject)与操作码表,
|
|
216
|
+
// 二者都不在本变换触及的范围内。
|
|
217
|
+
minVersion: 99,
|
|
218
|
+
maxVersion: 99,
|
|
219
|
+
headerFields: V98_LATE_HEADER_FIELDS,
|
|
209
220
|
sections: V98_SECTIONS,
|
|
210
221
|
},
|
|
211
222
|
{
|
package/lib/utils/hermes-raw.js
CHANGED
|
@@ -46,7 +46,8 @@ async function readHermesSemanticData(file) {
|
|
|
46
46
|
// A newly added diff-transform layout must not silently opt into semantic
|
|
47
47
|
// parsing: function header and operand schemas need an independent review.
|
|
48
48
|
if (!((resolved.version >= 87 && resolved.version <= 96) ||
|
|
49
|
-
resolved.version === 98
|
|
49
|
+
resolved.version === 98 ||
|
|
50
|
+
resolved.version === 99)) {
|
|
50
51
|
throw new UnverifiableHermesBytecode('unsupported semantic HBC version');
|
|
51
52
|
}
|
|
52
53
|
const layout = requireValue((0, hbcTransform_1.pickLayout)(bytes), 'unknown HBC layout');
|
|
@@ -80,7 +81,11 @@ async function readHermesSemanticData(file) {
|
|
|
80
81
|
// hbcTransform's file-header variants do not distinguish that function
|
|
81
82
|
// schema change. A compiler upgrade needs independent large/small fixtures;
|
|
82
83
|
// do not infer either schema from numStringSwitchImms or HBC version alone.
|
|
83
|
-
|
|
84
|
+
// Audited v99 function schema: hermes-compiler 260318099.0.4 (RN 0.88), the
|
|
85
|
+
// first HBC bump after that removal, so it always has the 36-byte form.
|
|
86
|
+
const shaped = resolved.version >= 98;
|
|
87
|
+
const noCacheNewObject = resolved.version === 99;
|
|
88
|
+
const largeSize = noCacheNewObject ? 36 : 37;
|
|
84
89
|
const entrySize = shaped ? 12 : 16;
|
|
85
90
|
const headers = section('functionHeaders');
|
|
86
91
|
const functions = [];
|
|
@@ -97,15 +102,15 @@ async function readHermesSemanticData(file) {
|
|
|
97
102
|
const largeOffset = shaped
|
|
98
103
|
? ((word1 >>> 14) & 0xff) * 0x1000000 + offset
|
|
99
104
|
: (headers.readUInt32LE(at + 8) & 0x1ffffff) * 0x10000 + offset;
|
|
100
|
-
const large = checkedSlice(bytes, largeOffset, shaped ?
|
|
105
|
+
const large = checkedSlice(bytes, largeOffset, shaped ? largeSize : 31);
|
|
101
106
|
offset = large.readUInt32LE(0);
|
|
102
107
|
size = large.readUInt32LE(shaped ? 12 : 8);
|
|
103
108
|
name = large.readUInt32LE(shaped ? 16 : 12);
|
|
104
|
-
flags = large[shaped ?
|
|
109
|
+
flags = large[shaped ? largeSize - 1 : 30];
|
|
105
110
|
fields = shaped
|
|
106
111
|
? [4, 8, 20, 24, 28].map((p) => large.readUInt32LE(p))
|
|
107
112
|
: [4, 20, 24].map((p) => large.readUInt32LE(p));
|
|
108
|
-
fields.push(...large.subarray(shaped ? 32 : 28, shaped ?
|
|
113
|
+
fields.push(...large.subarray(shaped ? 32 : 28, shaped ? largeSize - 1 : 30));
|
|
109
114
|
}
|
|
110
115
|
else if (shaped) {
|
|
111
116
|
size = word1 & 0x3fff;
|
|
@@ -117,9 +122,13 @@ async function readHermesSemanticData(file) {
|
|
|
117
122
|
word1 >>> 27,
|
|
118
123
|
headers[at + 8],
|
|
119
124
|
headers[at + 9],
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
...(noCacheNewObject
|
|
126
|
+
? [headers[at + 10] & 127, headers[at + 10] >>> 7]
|
|
127
|
+
: [
|
|
128
|
+
headers[at + 10] & 63,
|
|
129
|
+
(headers[at + 10] >>> 6) & 1,
|
|
130
|
+
headers[at + 10] >>> 7,
|
|
131
|
+
]),
|
|
123
132
|
];
|
|
124
133
|
}
|
|
125
134
|
else {
|
|
@@ -344,6 +353,10 @@ function normalizeRawHermesFunction(lines, data, functionIndex, buffers) {
|
|
|
344
353
|
operands[shapeAt + 1] = requireValue(literal.objectValues(values[shapeAt + 1], shape.count), 'undecodable shape values');
|
|
345
354
|
}
|
|
346
355
|
}
|
|
356
|
+
else if (op === 'NewTypedObjectWithBuffer') {
|
|
357
|
+
// HBC v99 typed-mode buffer user; its literal operands are not decoded.
|
|
358
|
+
throw new UnverifiableHermesBytecode('typed object literal buffer');
|
|
359
|
+
}
|
|
347
360
|
else if (op === 'CacheNewObject') {
|
|
348
361
|
if (buffers.layout !== 'shaped' || values.length !== 4) {
|
|
349
362
|
throw new UnverifiableHermesBytecode('unknown cached object operands');
|
package/package.json
CHANGED