protobufjs 7.5.5 → 7.5.7

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.5.5 (c) 2016, daniel wirtz
3
- * compiled wed, 15 apr 2026 04:40:15 utc
2
+ * protobuf.js v7.5.7 (c) 2016, daniel wirtz
3
+ * compiled sat, 09 may 2026 05:45:39 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -658,13 +658,33 @@ module.exports = inquire;
658
658
  * @returns {?Object} Required module if available and not empty, otherwise `null`
659
659
  */
660
660
  function inquire(moduleName) {
661
- try {
662
- var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
663
- if (mod && (mod.length || Object.keys(mod).length))
664
- return mod;
665
- } catch (e) {} // eslint-disable-line no-empty
661
+ try {
662
+ if (typeof require !== "function") {
663
+ return null;
664
+ }
665
+ var mod = require(moduleName);
666
+ if (mod && (mod.length || Object.keys(mod).length)) return mod;
667
+ return null;
668
+ } catch (err) {
669
+ // ignore
666
670
  return null;
671
+ }
667
672
  }
673
+
674
+ /*
675
+ // maybe worth a shot to prevent renaming issues:
676
+ // see: https://github.com/webpack/webpack/blob/master/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
677
+ // triggers on:
678
+ // - expression require.cache
679
+ // - expression require (???)
680
+ // - call require
681
+ // - call require:commonjs:item
682
+ // - call require:commonjs:context
683
+
684
+ Object.defineProperty(Function.prototype, "__self", { get: function() { return this; } });
685
+ var r = require.__self;
686
+ delete Function.prototype.__self;
687
+ */
668
688
 
669
689
  },{}],6:[function(require,module,exports){
670
690
  "use strict";
@@ -724,7 +744,8 @@ function pool(alloc, slice, size) {
724
744
  * @memberof util
725
745
  * @namespace
726
746
  */
727
- var utf8 = exports;
747
+ var utf8 = exports,
748
+ replacementChar = "\ufffd";
728
749
 
729
750
  /**
730
751
  * Calculates the UTF8 byte length of a string.
@@ -757,36 +778,34 @@ utf8.length = function utf8_length(string) {
757
778
  * @returns {string} String read
758
779
  */
759
780
  utf8.read = function utf8_read(buffer, start, end) {
760
- var len = end - start;
761
- if (len < 1)
781
+ if (end - start < 1) {
762
782
  return "";
763
- var parts = null,
764
- chunk = [],
765
- i = 0, // char offset
766
- t; // temporary
767
- while (start < end) {
768
- t = buffer[start++];
769
- if (t < 128)
770
- chunk[i++] = t;
771
- else if (t > 191 && t < 224)
772
- chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
773
- else if (t > 239 && t < 365) {
774
- t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
775
- chunk[i++] = 0xD800 + (t >> 10);
776
- chunk[i++] = 0xDC00 + (t & 1023);
777
- } else
778
- chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
779
- if (i > 8191) {
780
- (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
781
- i = 0;
782
- }
783
783
  }
784
- if (parts) {
785
- if (i)
786
- parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
787
- return parts.join("");
784
+
785
+ var str = "";
786
+ for (var i = start; i < end;) {
787
+ var t = buffer[i++];
788
+ if (t <= 0x7F) {
789
+ str += String.fromCharCode(t);
790
+ } else if (t >= 0xC0 && t < 0xE0) {
791
+ var c2 = (t & 0x1F) << 6 | buffer[i++] & 0x3F;
792
+ str += c2 >= 0x80 ? String.fromCharCode(c2) : replacementChar;
793
+ } else if (t >= 0xE0 && t < 0xF0) {
794
+ var c3 = (t & 0xF) << 12 | (buffer[i++] & 0x3F) << 6 | buffer[i++] & 0x3F;
795
+ str += c3 >= 0x800 ? String.fromCharCode(c3) : replacementChar;
796
+ } else if (t >= 0xF0) {
797
+ var t2 = (t & 7) << 18 | (buffer[i++] & 0x3F) << 12 | (buffer[i++] & 0x3F) << 6 | buffer[i++] & 0x3F;
798
+ if (t2 < 0x10000 || t2 > 0x10FFFF)
799
+ str += replacementChar;
800
+ else {
801
+ t2 -= 0x10000;
802
+ str += String.fromCharCode(0xD800 + (t2 >> 10));
803
+ str += String.fromCharCode(0xDC00 + (t2 & 0x3FF));
804
+ }
805
+ }
788
806
  }
789
- return String.fromCharCode.apply(String, chunk.slice(0, i));
807
+
808
+ return str;
790
809
  };
791
810
 
792
811
  /**
@@ -1216,12 +1235,22 @@ Reader.prototype.skip = function skip(length) {
1216
1235
  return this;
1217
1236
  };
1218
1237
 
1238
+ /**
1239
+ * Recursion limit.
1240
+ * @type {number}
1241
+ */
1242
+ Reader.recursionLimit = util.recursionLimit;
1243
+
1219
1244
  /**
1220
1245
  * Skips the next element of the specified wire type.
1221
1246
  * @param {number} wireType Wire type received
1247
+ * @param {number} [depth] Depth of recursion to control nested calls; 0 if omitted
1222
1248
  * @returns {Reader} `this`
1223
1249
  */
1224
- Reader.prototype.skipType = function(wireType) {
1250
+ Reader.prototype.skipType = function(wireType, depth) {
1251
+ if (depth === undefined) depth = 0;
1252
+ if (depth > Reader.recursionLimit)
1253
+ throw Error("maximum nesting depth exceeded");
1225
1254
  switch (wireType) {
1226
1255
  case 0:
1227
1256
  this.skip();
@@ -1234,7 +1263,7 @@ Reader.prototype.skipType = function(wireType) {
1234
1263
  break;
1235
1264
  case 3:
1236
1265
  while ((wireType = this.uint32() & 7) !== 4) {
1237
- this.skipType(wireType);
1266
+ this.skipType(wireType, depth + 1);
1238
1267
  }
1239
1268
  break;
1240
1269
  case 5:
@@ -1976,12 +2005,35 @@ util.longFromHash = function longFromHash(hash, unsigned) {
1976
2005
  function merge(dst, src, ifNotSet) { // used by converters
1977
2006
  for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
1978
2007
  if (dst[keys[i]] === undefined || !ifNotSet)
1979
- dst[keys[i]] = src[keys[i]];
2008
+ if (keys[i] !== "__proto__")
2009
+ dst[keys[i]] = src[keys[i]];
1980
2010
  return dst;
1981
2011
  }
1982
2012
 
1983
2013
  util.merge = merge;
1984
2014
 
2015
+ /**
2016
+ * Recursion limit.
2017
+ * @memberof util
2018
+ * @type {number}
2019
+ */
2020
+ util.recursionLimit = 100;
2021
+
2022
+ /**
2023
+ * Makes a property safe for assignment as an own property.
2024
+ * @memberof util
2025
+ * @param {Object.<string,*>} obj Object
2026
+ * @param {string} key Property key
2027
+ * @returns {undefined}
2028
+ */
2029
+ util.makeProp = function makeProp(obj, key) {
2030
+ Object.defineProperty(obj, key, {
2031
+ enumerable: true,
2032
+ configurable: true,
2033
+ writable: true
2034
+ });
2035
+ };
2036
+
1985
2037
  /**
1986
2038
  * Converts the first character of a string to lower case.
1987
2039
  * @param {string} str String to convert