11import { prettyByte } from "./utils/prettyByte" ;
22import { ExtensionCodec , ExtensionCodecType } from "./ExtensionCodec" ;
3- import { getInt64 , getUint64 } from "./utils/int" ;
3+ import { getInt64 , getUint64 , UINT32_MAX } from "./utils/int" ;
44import { utf8DecodeJs , TEXT_DECODER_THRESHOLD , utf8DecodeTD } from "./utils/utf8" ;
55import { createDataView , ensureUint8Array } from "./utils/typedArrays" ;
66import { CachedKeyDecoder , KeyDecoder } from "./CachedKeyDecoder" ;
@@ -57,8 +57,6 @@ export const DataViewIndexOutOfBoundsError: typeof Error = (() => {
5757
5858const MORE_DATA = new DataViewIndexOutOfBoundsError ( "Insufficient data" ) ;
5959
60- const DEFAULT_MAX_LENGTH = 0xffff_ffff ; // uint32_max
61-
6260const sharedCachedKeyDecoder = new CachedKeyDecoder ( ) ;
6361
6462export class Decoder < ContextType = undefined > {
@@ -73,11 +71,11 @@ export class Decoder<ContextType = undefined> {
7371 public constructor (
7472 private readonly extensionCodec : ExtensionCodecType < ContextType > = ExtensionCodec . defaultCodec as any ,
7573 private readonly context : ContextType = undefined as any ,
76- private readonly maxStrLength = DEFAULT_MAX_LENGTH ,
77- private readonly maxBinLength = DEFAULT_MAX_LENGTH ,
78- private readonly maxArrayLength = DEFAULT_MAX_LENGTH ,
79- private readonly maxMapLength = DEFAULT_MAX_LENGTH ,
80- private readonly maxExtLength = DEFAULT_MAX_LENGTH ,
74+ private readonly maxStrLength = UINT32_MAX ,
75+ private readonly maxBinLength = UINT32_MAX ,
76+ private readonly maxArrayLength = UINT32_MAX ,
77+ private readonly maxMapLength = UINT32_MAX ,
78+ private readonly maxExtLength = UINT32_MAX ,
8179 private readonly keyDecoder : KeyDecoder | null = sharedCachedKeyDecoder ,
8280 ) { }
8381
0 commit comments