Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
admin: updated dist files
  • Loading branch information
ricmoo committed Jan 13, 2024
1 parent 1b4debd commit 2f36f59
Show file tree
Hide file tree
Showing 34 changed files with 159 additions and 40 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,11 @@ Change Log

This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated.

ethers/v6.10.0 (2024-01-12 19:46)
---------------------------------

- Limit decoded result imflation ratio from ABI-encoded data ([#4537](https://github.com/ethers-io/ethers.js/issues/4537); [1b4debd](https://github.com/ethers-io/ethers.js/commit/1b4debd4a9e61d171bfc60590116facb8bdbd2da)).

ethers/v6.9.2 (2024-01-02 19:12)
--------------------------------

Expand Down
36 changes: 32 additions & 4 deletions dist/ethers.js
Expand Up @@ -3,7 +3,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
/**
* The current version of Ethers.
*/
const version = "6.9.2";
const version = "6.10.0";

/**
* Property helper functions.
Expand Down Expand Up @@ -2970,15 +2970,35 @@ class Reader {
allowLoose;
#data;
#offset;
constructor(data, allowLoose) {
#bytesRead;
#parent;
#maxInflation;
constructor(data, allowLoose, maxInflation) {
defineProperties(this, { allowLoose: !!allowLoose });
this.#data = getBytesCopy(data);
this.#bytesRead = 0;
this.#parent = null;
this.#maxInflation = (maxInflation != null) ? maxInflation : 1024;
this.#offset = 0;
}
get data() { return hexlify(this.#data); }
get dataLength() { return this.#data.length; }
get consumed() { return this.#offset; }
get bytes() { return new Uint8Array(this.#data); }
#incrementBytesRead(count) {
if (this.#parent) {
return this.#parent.#incrementBytesRead(count);
}
this.#bytesRead += count;
// Check for excessive inflation (see: #4537)
assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
buffer: getBytesCopy(this.#data), offset: this.#offset,
length: count, info: {
bytesRead: this.#bytesRead,
dataLength: this.dataLength
}
});
}
#peekBytes(offset, length, loose) {
let alignedLength = Math.ceil(length / WordSize) * WordSize;
if (this.#offset + alignedLength > this.#data.length) {
Expand All @@ -2997,11 +3017,14 @@ class Reader {
}
// Create a sub-reader with the same underlying data, but offset
subReader(offset) {
return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose);
const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);
reader.#parent = this;
return reader;
}
// Read bytes
readBytes(length, loose) {
let bytes = this.#peekBytes(0, length, !!loose);
this.#incrementBytesRead(length);
this.#offset += bytes.length;
// @TODO: Make sure the length..end bytes are all 0?
return bytes.slice(0, length);
Expand Down Expand Up @@ -12232,6 +12255,7 @@ PanicReasons$1.set(0x51, "UNINITIALIZED_FUNCTION_CALL");
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
let defaultCoder = null;
let defaultMaxInflation = 1024;
function getBuiltinCallException(action, tx, data, abiCoder) {
let message = "missing revert data";
let reason = null;
Expand Down Expand Up @@ -12368,7 +12392,11 @@ class AbiCoder {
decode(types, data, loose) {
const coders = types.map((type) => this.#getCoder(ParamType.from(type)));
const coder = new TupleCoder(coders, "_");
return coder.decode(new Reader(data, loose));
return coder.decode(new Reader(data, loose, defaultMaxInflation));
}
static _setDefaultMaxInflation(value) {
assertArgument(typeof (value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value);
defaultMaxInflation = value;
}
/**
* Returns the shared singleton instance of a default [[AbiCoder]].
Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.min.js

Large diffs are not rendered by default.

36 changes: 32 additions & 4 deletions dist/ethers.umd.js
Expand Up @@ -9,7 +9,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
/**
* The current version of Ethers.
*/
const version = "6.9.2";
const version = "6.10.0";

/**
* Property helper functions.
Expand Down Expand Up @@ -2976,15 +2976,35 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
allowLoose;
#data;
#offset;
constructor(data, allowLoose) {
#bytesRead;
#parent;
#maxInflation;
constructor(data, allowLoose, maxInflation) {
defineProperties(this, { allowLoose: !!allowLoose });
this.#data = getBytesCopy(data);
this.#bytesRead = 0;
this.#parent = null;
this.#maxInflation = (maxInflation != null) ? maxInflation : 1024;
this.#offset = 0;
}
get data() { return hexlify(this.#data); }
get dataLength() { return this.#data.length; }
get consumed() { return this.#offset; }
get bytes() { return new Uint8Array(this.#data); }
#incrementBytesRead(count) {
if (this.#parent) {
return this.#parent.#incrementBytesRead(count);
}
this.#bytesRead += count;
// Check for excessive inflation (see: #4537)
assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
buffer: getBytesCopy(this.#data), offset: this.#offset,
length: count, info: {
bytesRead: this.#bytesRead,
dataLength: this.dataLength
}
});
}
#peekBytes(offset, length, loose) {
let alignedLength = Math.ceil(length / WordSize) * WordSize;
if (this.#offset + alignedLength > this.#data.length) {
Expand All @@ -3003,11 +3023,14 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
}
// Create a sub-reader with the same underlying data, but offset
subReader(offset) {
return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose);
const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);
reader.#parent = this;
return reader;
}
// Read bytes
readBytes(length, loose) {
let bytes = this.#peekBytes(0, length, !!loose);
this.#incrementBytesRead(length);
this.#offset += bytes.length;
// @TODO: Make sure the length..end bytes are all 0?
return bytes.slice(0, length);
Expand Down Expand Up @@ -12238,6 +12261,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
let defaultCoder = null;
let defaultMaxInflation = 1024;
function getBuiltinCallException(action, tx, data, abiCoder) {
let message = "missing revert data";
let reason = null;
Expand Down Expand Up @@ -12374,7 +12398,11 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
decode(types, data, loose) {
const coders = types.map((type) => this.#getCoder(ParamType.from(type)));
const coder = new TupleCoder(coders, "_");
return coder.decode(new Reader(data, loose));
return coder.decode(new Reader(data, loose, defaultMaxInflation));
}
static _setDefaultMaxInflation(value) {
assertArgument(typeof (value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value);
defaultMaxInflation = value;
}
/**
* Returns the shared singleton instance of a default [[AbiCoder]].
Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/wordlists-extra.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/wordlists-extra.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/wordlists-extra.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib.commonjs/_version.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.commonjs/_version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.commonjs/_version.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib.commonjs/abi/abi-coder.d.ts
Expand Up @@ -40,6 +40,7 @@ export declare class AbiCoder {
* padded event data emitted from ``external`` functions.
*/
decode(types: ReadonlyArray<string | ParamType>, data: BytesLike, loose?: boolean): Result;
static _setDefaultMaxInflation(value: number): void;
/**
* Returns the shared singleton instance of a default [[AbiCoder]].
*
Expand Down
2 changes: 1 addition & 1 deletion lib.commonjs/abi/abi-coder.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib.commonjs/abi/abi-coder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2f36f59

Please sign in to comment.