@@ -1912,11 +1912,13 @@ func (d *decoderBincBytes) kSlice(f *decFnInfo, rv reflect.Value) {
19121912 rvlen := rvLenSlice (rv )
19131913 rvcap := rvCapSlice (rv )
19141914 maxInitLen := d .maxInitLen ()
1915+ maxBytesLen := uint (d .h .maxBytes2Read ())
1916+
19151917 hasLen := containerLenS >= 0
19161918 if hasLen {
19171919 if containerLenS > rvcap {
19181920 oldRvlenGtZero := rvlen > 0
1919- rvlen1 := int (decInferLen (containerLenS , maxInitLen , uint (ti .elemsize )))
1921+ rvlen1 := int (decInferLen (containerLenS , maxInitLen , maxBytesLen , uint (ti .elemsize )))
19201922 if rvlen1 == rvlen {
19211923 } else if rvlen1 <= rvcap {
19221924 if rvCanset {
@@ -1959,7 +1961,7 @@ func (d *decoderBincBytes) kSlice(f *decFnInfo, rv reflect.Value) {
19591961 if j == 0 {
19601962 if rvIsNil (rv ) {
19611963 if rvCanset {
1962- rvlen = int (decInferLen (containerLenS , maxInitLen , uint (ti .elemsize )))
1964+ rvlen = int (decInferLen (containerLenS , maxInitLen , maxBytesLen , uint (ti .elemsize )))
19631965 rv , rvCanset = rvMakeSlice (rv , f .ti , rvlen , rvlen )
19641966 rvcap = rvlen
19651967 rvChanged = ! rvCanset
@@ -2215,12 +2217,13 @@ func (d *decoderBincBytes) kChan(f *decFnInfo, rv reflect.Value) {
22152217 var rvlen int
22162218 hasLen := containerLenS >= 0
22172219 maxInitLen := d .maxInitLen ()
2220+ maxBytesLen := uint (d .h .maxBytes2Read ())
22182221
22192222 for j := 0 ; d .containerNext (j , containerLenS , hasLen ); j ++ {
22202223 if j == 0 {
22212224 if rvIsNil (rv ) {
22222225 if hasLen {
2223- rvlen = int (decInferLen (containerLenS , maxInitLen , uint (ti .elemsize )))
2226+ rvlen = int (decInferLen (containerLenS , maxInitLen , maxBytesLen , uint (ti .elemsize )))
22242227 } else {
22252228 rvlen = decDefChanCap
22262229 }
@@ -2273,7 +2276,7 @@ func (d *decoderBincBytes) kMap(f *decFnInfo, rv reflect.Value) {
22732276 containerLen := d .mapStart (d .d .ReadMapStart ())
22742277 ti := f .ti
22752278 if rvIsNil (rv ) {
2276- rvlen := int (decInferLen (containerLen , d .maxInitLen (), uint (ti .keysize + ti .elemsize )))
2279+ rvlen := int (decInferLen (containerLen , d .maxInitLen (), uint (d . h . maxBytes2Read ()), uint ( ti .keysize + ti .elemsize )))
22772280 rvSetDirect (rv , makeMapReflect (ti .rt , rvlen ))
22782281 }
22792282
@@ -5988,11 +5991,13 @@ func (d *decoderBincIO) kSlice(f *decFnInfo, rv reflect.Value) {
59885991 rvlen := rvLenSlice (rv )
59895992 rvcap := rvCapSlice (rv )
59905993 maxInitLen := d .maxInitLen ()
5994+ maxBytesLen := uint (d .h .maxBytes2Read ())
5995+
59915996 hasLen := containerLenS >= 0
59925997 if hasLen {
59935998 if containerLenS > rvcap {
59945999 oldRvlenGtZero := rvlen > 0
5995- rvlen1 := int (decInferLen (containerLenS , maxInitLen , uint (ti .elemsize )))
6000+ rvlen1 := int (decInferLen (containerLenS , maxInitLen , maxBytesLen , uint (ti .elemsize )))
59966001 if rvlen1 == rvlen {
59976002 } else if rvlen1 <= rvcap {
59986003 if rvCanset {
@@ -6035,7 +6040,7 @@ func (d *decoderBincIO) kSlice(f *decFnInfo, rv reflect.Value) {
60356040 if j == 0 {
60366041 if rvIsNil (rv ) {
60376042 if rvCanset {
6038- rvlen = int (decInferLen (containerLenS , maxInitLen , uint (ti .elemsize )))
6043+ rvlen = int (decInferLen (containerLenS , maxInitLen , maxBytesLen , uint (ti .elemsize )))
60396044 rv , rvCanset = rvMakeSlice (rv , f .ti , rvlen , rvlen )
60406045 rvcap = rvlen
60416046 rvChanged = ! rvCanset
@@ -6291,12 +6296,13 @@ func (d *decoderBincIO) kChan(f *decFnInfo, rv reflect.Value) {
62916296 var rvlen int
62926297 hasLen := containerLenS >= 0
62936298 maxInitLen := d .maxInitLen ()
6299+ maxBytesLen := uint (d .h .maxBytes2Read ())
62946300
62956301 for j := 0 ; d .containerNext (j , containerLenS , hasLen ); j ++ {
62966302 if j == 0 {
62976303 if rvIsNil (rv ) {
62986304 if hasLen {
6299- rvlen = int (decInferLen (containerLenS , maxInitLen , uint (ti .elemsize )))
6305+ rvlen = int (decInferLen (containerLenS , maxInitLen , maxBytesLen , uint (ti .elemsize )))
63006306 } else {
63016307 rvlen = decDefChanCap
63026308 }
@@ -6349,7 +6355,7 @@ func (d *decoderBincIO) kMap(f *decFnInfo, rv reflect.Value) {
63496355 containerLen := d .mapStart (d .d .ReadMapStart ())
63506356 ti := f .ti
63516357 if rvIsNil (rv ) {
6352- rvlen := int (decInferLen (containerLen , d .maxInitLen (), uint (ti .keysize + ti .elemsize )))
6358+ rvlen := int (decInferLen (containerLen , d .maxInitLen (), uint (d . h . maxBytes2Read ()), uint ( ti .keysize + ti .elemsize )))
63536359 rvSetDirect (rv , makeMapReflect (ti .rt , rvlen ))
63546360 }
63556361
0 commit comments