protobufjs 7.6.0 → 7.6.2

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.6.0 (c) 2016, daniel wirtz
3
- * compiled mon, 18 may 2026 18:11:08 utc
2
+ * protobuf.js v7.6.2 (c) 2016, daniel wirtz
3
+ * compiled sat, 30 may 2026 21:57:57 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -363,15 +363,23 @@ function EventEmitter() {
363
363
  * @type {Object.<string,*>}
364
364
  * @private
365
365
  */
366
- this._listeners = {};
366
+ this._listeners = Object.create(null);
367
367
  }
368
368
 
369
+ /**
370
+ * Event listener as used by {@link util.EventEmitter}.
371
+ * @typedef EventEmitterListener
372
+ * @type {function}
373
+ * @param {...*} args Arguments
374
+ * @returns {undefined}
375
+ */
376
+
369
377
  /**
370
378
  * Registers an event listener.
371
379
  * @param {string} evt Event name
372
- * @param {function} fn Listener
380
+ * @param {EventEmitterListener} fn Listener
373
381
  * @param {*} [ctx] Listener context
374
- * @returns {util.EventEmitter} `this`
382
+ * @returns {this} `this`
375
383
  */
376
384
  EventEmitter.prototype.on = function on(evt, fn, ctx) {
377
385
  (this._listeners[evt] || (this._listeners[evt] = [])).push({
@@ -384,17 +392,19 @@ EventEmitter.prototype.on = function on(evt, fn, ctx) {
384
392
  /**
385
393
  * Removes an event listener or any matching listeners if arguments are omitted.
386
394
  * @param {string} [evt] Event name. Removes all listeners if omitted.
387
- * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
388
- * @returns {util.EventEmitter} `this`
395
+ * @param {EventEmitterListener} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
396
+ * @returns {this} `this`
389
397
  */
390
398
  EventEmitter.prototype.off = function off(evt, fn) {
391
399
  if (evt === undefined)
392
- this._listeners = {};
400
+ this._listeners = Object.create(null);
393
401
  else {
394
402
  if (fn === undefined)
395
403
  this._listeners[evt] = [];
396
404
  else {
397
405
  var listeners = this._listeners[evt];
406
+ if (!listeners)
407
+ return this;
398
408
  for (var i = 0; i < listeners.length;)
399
409
  if (listeners[i].fn === fn)
400
410
  listeners.splice(i, 1);
@@ -409,7 +419,7 @@ EventEmitter.prototype.off = function off(evt, fn) {
409
419
  * Emits an event by calling its listeners with the specified arguments.
410
420
  * @param {string} evt Event name
411
421
  * @param {...*} args Arguments
412
- * @returns {util.EventEmitter} `this`
422
+ * @returns {this} `this`
413
423
  */
414
424
  EventEmitter.prototype.emit = function emit(evt) {
415
425
  var listeners = this._listeners[evt];
@@ -1197,7 +1207,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
1197
1207
  } gen
1198
1208
  ("}");
1199
1209
  } else gen
1200
- ("if(typeof d%s!==\"object\")", prop)
1210
+ ("if(!util.isObject(d%s))", prop)
1201
1211
  ("throw TypeError(%j)", field.fullName + ": object expected")
1202
1212
  ("m%s=types[%i].fromObject(d%s,n+1)", prop, fieldIndex, prop);
1203
1213
  } else {
@@ -1217,14 +1227,14 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
1217
1227
  ("m%s=d%s|0", prop, prop);
1218
1228
  break;
1219
1229
  case "uint64":
1230
+ case "fixed64":
1220
1231
  isUnsigned = true;
1221
1232
  // eslint-disable-next-line no-fallthrough
1222
1233
  case "int64":
1223
1234
  case "sint64":
1224
- case "fixed64":
1225
1235
  case "sfixed64": gen
1226
1236
  ("if(util.Long)")
1227
- ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned)
1237
+ ("m%s=util.Long.fromValue(d%s,%j)", prop, prop, isUnsigned)
1228
1238
  ("else if(typeof d%s===\"string\")", prop)
1229
1239
  ("m%s=parseInt(d%s,10)", prop, prop)
1230
1240
  ("else if(typeof d%s===\"number\")", prop)
@@ -1264,6 +1274,8 @@ converter.fromObject = function fromObject(mtype) {
1264
1274
  var gen = util.codegen(["d", "n"], mtype.name + "$fromObject")
1265
1275
  ("if(d instanceof this.ctor)")
1266
1276
  ("return d")
1277
+ ("if(!util.isObject(d))")
1278
+ ("throw TypeError(%j)", mtype.fullName + ": object expected")
1267
1279
  ("if(n===undefined)n=0")
1268
1280
  ("if(n>util.recursionLimit)")
1269
1281
  ("throw Error(\"maximum nesting depth exceeded\")");
@@ -1278,7 +1290,7 @@ converter.fromObject = function fromObject(mtype) {
1278
1290
  // Map fields
1279
1291
  if (field.map) { gen
1280
1292
  ("if(d%s){", prop)
1281
- ("if(typeof d%s!==\"object\")", prop)
1293
+ ("if(!util.isObject(d%s))", prop)
1282
1294
  ("throw TypeError(%j)", field.fullName + ": object expected")
1283
1295
  ("m%s={}", prop)
1284
1296
  ("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", prop);
@@ -1328,7 +1340,7 @@ function genValuePartial_toObject(gen, field, fieldIndex, prop) {
1328
1340
  if (field.resolvedType instanceof Enum) gen
1329
1341
  ("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", prop, fieldIndex, prop, prop, fieldIndex, prop, prop);
1330
1342
  else gen
1331
- ("d%s=types[%i].toObject(m%s,o)", prop, fieldIndex, prop);
1343
+ ("d%s=types[%i].toObject(m%s,o,q+1)", prop, fieldIndex, prop);
1332
1344
  } else {
1333
1345
  var isUnsigned = false;
1334
1346
  switch (field.type) {
@@ -1337,11 +1349,11 @@ function genValuePartial_toObject(gen, field, fieldIndex, prop) {
1337
1349
  ("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", prop, prop, prop, prop);
1338
1350
  break;
1339
1351
  case "uint64":
1352
+ case "fixed64":
1340
1353
  isUnsigned = true;
1341
1354
  // eslint-disable-next-line no-fallthrough
1342
1355
  case "int64":
1343
1356
  case "sint64":
1344
- case "fixed64":
1345
1357
  case "sfixed64": gen
1346
1358
  ("if(typeof BigInt!==\"undefined\"&&o.longs===BigInt)")
1347
1359
  ("d%s=typeof m%s===\"number\"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()", prop, prop, prop, prop, prop, isUnsigned)
@@ -1372,9 +1384,12 @@ converter.toObject = function toObject(mtype) {
1372
1384
  var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
1373
1385
  if (!fields.length)
1374
1386
  return util.codegen()("return {}");
1375
- var gen = util.codegen(["m", "o"], mtype.name + "$toObject")
1387
+ var gen = util.codegen(["m", "o", "q"], mtype.name + "$toObject")
1376
1388
  ("if(!o)")
1377
1389
  ("o={}")
1390
+ ("if(q===undefined)q=0")
1391
+ ("if(q>util.recursionLimit)")
1392
+ ("throw Error(\"max depth exceeded\")")
1378
1393
  ("var d={}");
1379
1394
 
1380
1395
  var repeatedFields = [],
@@ -1623,8 +1638,8 @@ var Enum = require(16),
1623
1638
  */
1624
1639
  function genTypePartial(gen, field, fieldIndex, ref) {
1625
1640
  return field.delimited
1626
- ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
1627
- : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
1641
+ ? gen("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
1642
+ : gen("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
1628
1643
  }
1629
1644
 
1630
1645
  /**
@@ -1634,9 +1649,12 @@ function genTypePartial(gen, field, fieldIndex, ref) {
1634
1649
  */
1635
1650
  function encoder(mtype) {
1636
1651
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
1637
- var gen = util.codegen(["m", "w"], mtype.name + "$encode")
1652
+ var gen = util.codegen(["m", "w", "q"], mtype.name + "$encode")
1638
1653
  ("if(!w)")
1639
- ("w=Writer.create()");
1654
+ ("w=Writer.create()")
1655
+ ("if(q===undefined)q=0")
1656
+ ("if(q>util.recursionLimit)")
1657
+ ("throw Error(\"max depth exceeded\")");
1640
1658
 
1641
1659
  var i, ref;
1642
1660
 
@@ -1657,7 +1675,7 @@ function encoder(mtype) {
1657
1675
  ("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", ref)
1658
1676
  ("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);
1659
1677
  if (wireType === undefined) gen
1660
- ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups
1678
+ ("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()", index, ref); // can't be groups
1661
1679
  else gen
1662
1680
  (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref);
1663
1681
  gen
@@ -1795,8 +1813,8 @@ Enum.prototype._resolveFeatures = function _resolveFeatures(edition) {
1795
1813
  ReflectionObject.prototype._resolveFeatures.call(this, edition);
1796
1814
 
1797
1815
  Object.keys(this.values).forEach(key => {
1798
- var parentFeaturesCopy = Object.assign({}, this._features);
1799
- this._valuesFeatures[key] = Object.assign(parentFeaturesCopy, this.valuesOptions && this.valuesOptions[key] && this.valuesOptions[key].features);
1816
+ var parentFeaturesCopy = util.merge({}, this._features);
1817
+ this._valuesFeatures[key] = util.merge(parentFeaturesCopy, this.valuesOptions && this.valuesOptions[key] && this.valuesOptions[key].features || {});
1800
1818
  });
1801
1819
 
1802
1820
  return this;
@@ -2265,7 +2283,7 @@ Field.prototype.resolve = function resolve() {
2265
2283
 
2266
2284
  // convert to internal data type if necesssary
2267
2285
  if (this.long) {
2268
- this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u");
2286
+ this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type === "uint64" || this.type === "fixed64");
2269
2287
 
2270
2288
  /* istanbul ignore else */
2271
2289
  if (Object.freeze)
@@ -3308,6 +3326,8 @@ Namespace.prototype.define = function define(path, json) {
3308
3326
  throw TypeError("illegal path");
3309
3327
  if (path && path.length && path[0] === "")
3310
3328
  throw Error("path must be relative");
3329
+ if (path.length > util.recursionLimit)
3330
+ throw Error("max depth exceeded");
3311
3331
 
3312
3332
  var ptr = this;
3313
3333
  while (path.length > 0) {
@@ -3742,7 +3762,7 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
3742
3762
  throw new Error("Unknown edition for " + this.fullName);
3743
3763
  }
3744
3764
 
3745
- var protoFeatures = Object.assign(this.options ? Object.assign({}, this.options.features) : {},
3765
+ var protoFeatures = util.merge({}, this.options && this.options.features,
3746
3766
  this._inferLegacyProtoFeatures(edition));
3747
3767
 
3748
3768
  if (this._edition) {
@@ -3757,7 +3777,7 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
3757
3777
  } else {
3758
3778
  throw new Error("Unknown edition: " + edition);
3759
3779
  }
3760
- this._features = Object.assign(defaults, protoFeatures || {});
3780
+ this._features = util.merge(defaults, protoFeatures);
3761
3781
  this._featuresResolved = true;
3762
3782
  return;
3763
3783
  }
@@ -3766,13 +3786,13 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
3766
3786
  // special-case it
3767
3787
  /* istanbul ignore else */
3768
3788
  if (this.partOf instanceof OneOf) {
3769
- var lexicalParentFeaturesCopy = Object.assign({}, this.partOf._features);
3770
- this._features = Object.assign(lexicalParentFeaturesCopy, protoFeatures || {});
3789
+ var lexicalParentFeaturesCopy = util.merge({}, this.partOf._features);
3790
+ this._features = util.merge(lexicalParentFeaturesCopy, protoFeatures);
3771
3791
  } else if (this.declaringField) {
3772
3792
  // Skip feature resolution of sister fields.
3773
3793
  } else if (this.parent) {
3774
- var parentFeaturesCopy = Object.assign({}, this.parent._features);
3775
- this._features = Object.assign(parentFeaturesCopy, protoFeatures || {});
3794
+ var parentFeaturesCopy = util.merge({}, this.parent._features);
3795
+ this._features = util.merge(parentFeaturesCopy, protoFeatures);
3776
3796
  } else {
3777
3797
  throw new Error("Unable to find a parent for " + this.fullName);
3778
3798
  }
@@ -4756,8 +4776,12 @@ Root.prototype.load = function load(filename, options, callback) {
4756
4776
  }
4757
4777
 
4758
4778
  // Processes a single file
4759
- function process(filename, source) {
4779
+ function process(filename, source, depth) {
4780
+ if (depth === undefined)
4781
+ depth = 0;
4760
4782
  try {
4783
+ if (depth > util.recursionLimit)
4784
+ throw Error("max depth exceeded");
4761
4785
  if (util.isString(source) && source.charAt(0) === "{")
4762
4786
  source = JSON.parse(source);
4763
4787
  if (!util.isString(source))
@@ -4770,11 +4794,11 @@ Root.prototype.load = function load(filename, options, callback) {
4770
4794
  if (parsed.imports)
4771
4795
  for (; i < parsed.imports.length; ++i)
4772
4796
  if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))
4773
- fetch(resolved);
4797
+ fetch(resolved, false, depth + 1);
4774
4798
  if (parsed.weakImports)
4775
4799
  for (i = 0; i < parsed.weakImports.length; ++i)
4776
4800
  if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))
4777
- fetch(resolved, true);
4801
+ fetch(resolved, true, depth + 1);
4778
4802
  }
4779
4803
  } catch (err) {
4780
4804
  finish(err);
@@ -4785,7 +4809,9 @@ Root.prototype.load = function load(filename, options, callback) {
4785
4809
  }
4786
4810
 
4787
4811
  // Fetches a single file
4788
- function fetch(filename, weak) {
4812
+ function fetch(filename, weak, depth) {
4813
+ if (depth === undefined)
4814
+ depth = 0;
4789
4815
  filename = getBundledFileName(filename) || filename;
4790
4816
 
4791
4817
  // Skip if already loaded / attempted
@@ -4797,12 +4823,12 @@ Root.prototype.load = function load(filename, options, callback) {
4797
4823
  // Shortcut bundled definitions
4798
4824
  if (filename in common) {
4799
4825
  if (sync) {
4800
- process(filename, common[filename]);
4826
+ process(filename, common[filename], depth);
4801
4827
  } else {
4802
4828
  ++queued;
4803
4829
  setTimeout(function() {
4804
4830
  --queued;
4805
- process(filename, common[filename]);
4831
+ process(filename, common[filename], depth);
4806
4832
  });
4807
4833
  }
4808
4834
  return;
@@ -4818,7 +4844,7 @@ Root.prototype.load = function load(filename, options, callback) {
4818
4844
  finish(err);
4819
4845
  return;
4820
4846
  }
4821
- process(filename, source);
4847
+ process(filename, source, depth);
4822
4848
  } else {
4823
4849
  ++queued;
4824
4850
  self.fetch(filename, function(err, source) {
@@ -4835,7 +4861,7 @@ Root.prototype.load = function load(filename, options, callback) {
4835
4861
  finish(null, self);
4836
4862
  return;
4837
4863
  }
4838
- process(filename, source);
4864
+ process(filename, source, depth);
4839
4865
  });
4840
4866
  }
4841
4867
  }
@@ -5025,7 +5051,7 @@ Root._configure = function(Type_, parse_, common_) {
5025
5051
 
5026
5052
  },{"16":16,"17":17,"23":23,"25":25,"35":35}],29:[function(require,module,exports){
5027
5053
  "use strict";
5028
- module.exports = {};
5054
+ module.exports = Object.create(null);
5029
5055
 
5030
5056
  /**
5031
5057
  * Named roots.
@@ -5662,7 +5688,10 @@ function clearCache(type) {
5662
5688
  * @returns {Type} Created message type
5663
5689
  */
5664
5690
  Type.fromJSON = function fromJSON(name, json, depth) {
5665
- depth = util.checkDepth(depth);
5691
+ if (depth === undefined)
5692
+ depth = 0;
5693
+ if (depth > util.nestingLimit)
5694
+ throw Error("max depth exceeded");
5666
5695
  var type = new Type(name, json.options);
5667
5696
  type.extensions = json.extensions;
5668
5697
  type.reserved = json.reserved;
@@ -5940,8 +5969,8 @@ Type.prototype.setup = function setup() {
5940
5969
  * @param {Writer} [writer] Writer to encode to
5941
5970
  * @returns {Writer} writer
5942
5971
  */
5943
- Type.prototype.encode = function encode_setup(message, writer) {
5944
- return this.setup().encode(message, writer); // overrides this method
5972
+ Type.prototype.encode = function encode_setup(message, writer) { // eslint-disable-line no-unused-vars
5973
+ return this.setup().encode.apply(this, arguments); // overrides this method
5945
5974
  };
5946
5975
 
5947
5976
  /**
@@ -6026,8 +6055,8 @@ Type.prototype.fromObject = function fromObject(object, depth) {
6026
6055
  * @param {IConversionOptions} [options] Conversion options
6027
6056
  * @returns {Object.<string,*>} Plain object
6028
6057
  */
6029
- Type.prototype.toObject = function toObject(message, options) {
6030
- return this.setup().toObject(message, options);
6058
+ Type.prototype.toObject = function toObject(message, options) { // eslint-disable-line no-unused-vars
6059
+ return this.setup().toObject.apply(this, arguments);
6031
6060
  };
6032
6061
 
6033
6062
  /**
@@ -6268,8 +6297,7 @@ util.fetch = require(5);
6268
6297
  util.path = require(9);
6269
6298
  util.patterns = require(39);
6270
6299
 
6271
- var reservedRe = util.patterns.reservedRe,
6272
- unsafePropertyRe = util.patterns.unsafePropertyRe;
6300
+ var reservedRe = util.patterns.reservedRe;
6273
6301
 
6274
6302
  /**
6275
6303
  * Node's fs module if available.
@@ -6444,7 +6472,7 @@ util.decorateEnum = function decorateEnum(object) {
6444
6472
  util.setProperty = function setProperty(dst, path, value, ifNotSet) {
6445
6473
  function setProp(dst, path, value) {
6446
6474
  var part = path.shift();
6447
- if (unsafePropertyRe.test(part))
6475
+ if (util.isUnsafeProperty(part))
6448
6476
  return dst;
6449
6477
  if (path.length > 0) {
6450
6478
  dst[part] = setProp(dst[part] || {}, path, value);
@@ -6465,6 +6493,8 @@ util.setProperty = function setProperty(dst, path, value, ifNotSet) {
6465
6493
  throw TypeError("path must be specified");
6466
6494
 
6467
6495
  path = path.split(".");
6496
+ if (path.length > util.recursionLimit)
6497
+ throw Error("max depth exceeded");
6468
6498
  return setProp(dst, path, value);
6469
6499
  };
6470
6500
 
@@ -6723,6 +6753,18 @@ util.pool = require(10);
6723
6753
  // utility to work with the low and high bits of a 64 bit value
6724
6754
  util.LongBits = require(37);
6725
6755
 
6756
+ /**
6757
+ * Tests if the specified key can affect object prototypes.
6758
+ * @memberof util
6759
+ * @param {string} key Key to test
6760
+ * @returns {boolean} `true` if the key is unsafe
6761
+ */
6762
+ function isUnsafeProperty(key) {
6763
+ return key === "__proto__" || key === "prototype" || key === "constructor";
6764
+ }
6765
+
6766
+ util.isUnsafeProperty = isUnsafeProperty;
6767
+
6726
6768
  /**
6727
6769
  * Whether running within node or not.
6728
6770
  * @memberof util
@@ -6936,26 +6978,39 @@ util.longFromHash = function longFromHash(hash, unsigned) {
6936
6978
  * Merges the properties of the source object into the destination object.
6937
6979
  * @memberof util
6938
6980
  * @param {Object.<string,*>} dst Destination object
6939
- * @param {Object.<string,*>} src Source object
6940
- * @param {boolean} [ifNotSet=false] Merges only if the key is not already set
6981
+ * @param {...(Object.<string,*>|boolean)} src Source objects, optionally followed by an `ifNotSet` flag
6941
6982
  * @returns {Object.<string,*>} Destination object
6942
6983
  */
6943
- function merge(dst, src, ifNotSet) { // used by converters
6944
- for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
6945
- if (dst[keys[i]] === undefined || !ifNotSet)
6946
- if (keys[i] !== "__proto__")
6984
+ function merge(dst) { // used by converters
6985
+ var ifNotSet = typeof arguments[arguments.length - 1] === "boolean",
6986
+ limit = ifNotSet ? arguments.length - 1 : arguments.length;
6987
+ ifNotSet = ifNotSet && arguments[arguments.length - 1];
6988
+ for (var a = 1; a < limit; ++a) {
6989
+ var src = arguments[a];
6990
+ if (!src)
6991
+ continue;
6992
+ for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
6993
+ if (!isUnsafeProperty(keys[i]) && (dst[keys[i]] === undefined || !ifNotSet))
6947
6994
  dst[keys[i]] = src[keys[i]];
6995
+ }
6948
6996
  return dst;
6949
6997
  }
6950
6998
 
6951
6999
  util.merge = merge;
6952
7000
 
7001
+ /**
7002
+ * Schema declaration nesting limit.
7003
+ * @memberof util
7004
+ * @type {number}
7005
+ */
7006
+ util.nestingLimit = 32; // protoc: MaxMessageDeclarationNestingDepth
7007
+
6953
7008
  /**
6954
7009
  * Recursion limit.
6955
7010
  * @memberof util
6956
7011
  * @type {number}
6957
7012
  */
6958
- util.recursionLimit = 100;
7013
+ util.recursionLimit = 100; // protoc: CodedInputStream::default_recursion_limit_
6959
7014
 
6960
7015
  /**
6961
7016
  * Makes a property safe for assignment as an own property.
@@ -7174,7 +7229,6 @@ var patterns = exports;
7174
7229
  patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
7175
7230
  patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
7176
7231
  patterns.reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
7177
- patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
7178
7232
 
7179
7233
  },{}],40:[function(require,module,exports){
7180
7234
  "use strict";
@@ -7368,7 +7422,8 @@ function verifier(mtype) {
7368
7422
  */
7369
7423
  var wrappers = exports;
7370
7424
 
7371
- var Message = require(21);
7425
+ var Message = require(21),
7426
+ util = require(38);
7372
7427
 
7373
7428
  /**
7374
7429
  * From object converter part of an {@link IWrapper}.
@@ -7415,10 +7470,9 @@ wrappers[".google.protobuf.Any"] = {
7415
7470
  if (type_url.indexOf("/") === -1) {
7416
7471
  type_url = "/" + type_url;
7417
7472
  }
7418
- var nextDepth = depth === undefined ? 1 : depth + 1;
7419
7473
  return this.create({
7420
7474
  type_url: type_url,
7421
- value: type.encode(type.fromObject(object, nextDepth)).finish()
7475
+ value: type.encode(type.fromObject(object, depth === undefined ? 1 : depth + 1)).finish()
7422
7476
  });
7423
7477
  }
7424
7478
  }
@@ -7426,7 +7480,11 @@ wrappers[".google.protobuf.Any"] = {
7426
7480
  return this.fromObject(object, depth);
7427
7481
  },
7428
7482
 
7429
- toObject: function(message, options) {
7483
+ toObject: function(message, options, depth) {
7484
+ if (depth === undefined)
7485
+ depth = 0;
7486
+ if (depth > util.recursionLimit)
7487
+ throw Error("max depth exceeded");
7430
7488
 
7431
7489
  // Default prefix
7432
7490
  var googleApi = "type.googleapis.com/";
@@ -7442,12 +7500,12 @@ wrappers[".google.protobuf.Any"] = {
7442
7500
  var type = this.lookup(name);
7443
7501
  /* istanbul ignore else */
7444
7502
  if (type)
7445
- message = type.decode(message.value);
7503
+ message = type.decode(message.value, undefined, undefined, depth + 1);
7446
7504
  }
7447
7505
 
7448
7506
  // wrap value if unmapped
7449
7507
  if (!(message instanceof this.ctor) && message instanceof Message) {
7450
- var object = message.$type.toObject(message, options);
7508
+ var object = message.$type.toObject(message, options, depth + 1);
7451
7509
  var messageName = message.$type.fullName[0] === "." ?
7452
7510
  message.$type.fullName.slice(1) : message.$type.fullName;
7453
7511
  // Default to type.googleapis.com prefix if no prefix is used
@@ -7459,11 +7517,11 @@ wrappers[".google.protobuf.Any"] = {
7459
7517
  return object;
7460
7518
  }
7461
7519
 
7462
- return this.toObject(message, options);
7520
+ return this.toObject(message, options, depth);
7463
7521
  }
7464
7522
  };
7465
7523
 
7466
- },{"21":21}],42:[function(require,module,exports){
7524
+ },{"21":21,"38":38}],42:[function(require,module,exports){
7467
7525
  "use strict";
7468
7526
  module.exports = Writer;
7469
7527
 
@@ -7691,7 +7749,7 @@ Writer.prototype.uint32 = function write_uint32(value) {
7691
7749
  * @returns {Writer} `this`
7692
7750
  */
7693
7751
  Writer.prototype.int32 = function write_int32(value) {
7694
- return value < 0
7752
+ return (value |= 0) < 0
7695
7753
  ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec
7696
7754
  : this.uint32(value);
7697
7755
  };
@@ -7706,16 +7764,18 @@ Writer.prototype.sint32 = function write_sint32(value) {
7706
7764
  };
7707
7765
 
7708
7766
  function writeVarint64(val, buf, pos) {
7709
- while (val.hi) {
7710
- buf[pos++] = val.lo & 127 | 128;
7711
- val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;
7712
- val.hi >>>= 7;
7767
+ var lo = val.lo,
7768
+ hi = val.hi;
7769
+ while (hi) {
7770
+ buf[pos++] = lo & 127 | 128;
7771
+ lo = (lo >>> 7 | hi << 25) >>> 0;
7772
+ hi >>>= 7;
7713
7773
  }
7714
- while (val.lo > 127) {
7715
- buf[pos++] = val.lo & 127 | 128;
7716
- val.lo = val.lo >>> 7;
7774
+ while (lo > 127) {
7775
+ buf[pos++] = lo & 127 | 128;
7776
+ lo = lo >>> 7;
7717
7777
  }
7718
- buf[pos++] = val.lo;
7778
+ buf[pos++] = lo;
7719
7779
  }
7720
7780
 
7721
7781
  /**