Skip to content

Commit

Permalink
xdr: update decoders to use a maximum depth (#5057)
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio authored Sep 22, 2023
1 parent 716f5db commit 838b1c4
Show file tree
Hide file tree
Showing 6 changed files with 4,931 additions and 3,260 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ xdr/Stellar-contract.x \
xdr/Stellar-internal.x \
xdr/Stellar-contract-config-setting.x

XDRGEN_COMMIT=80e38ef2a96489f6b501d4db3a350406e5aa3bab
XDRGEN_COMMIT=a231a92475ac6154c0c2f46dc503809823985060
XDR_COMMIT=9ac02641139e6717924fdad716f6e958d0168491

.PHONY: xdr xdr-clean xdr-update
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.3.2
github.com/stellar/go-xdr v0.0.0-20211103144802-8017fc4bdfee
github.com/stellar/go-xdr v0.0.0-20230919160922-6c7b68458206
github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible
github.com/stretchr/testify v1.8.1
github.com/tyler-smith/go-bip39 v0.0.0-20180618194314-52158e4697b8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stellar/go-xdr v0.0.0-20211103144802-8017fc4bdfee h1:fbVs0xmXpBvVS4GBeiRmAE3Le70ofAqFMch1GTiq/e8=
github.com/stellar/go-xdr v0.0.0-20211103144802-8017fc4bdfee/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps=
github.com/stellar/go-xdr v0.0.0-20230919160922-6c7b68458206 h1:UFuvvpbWL8+jqO1QmKYWSVhiMp4MRiIFd8/zQlUINH0=
github.com/stellar/go-xdr v0.0.0-20230919160922-6c7b68458206/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps=
github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible h1:jMXXAcz6xTarGDQ4VtVbtERogcmDQw4RaE85Cr9CgoQ=
github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible/go.mod h1:7CJ23pXirXBJq45DqvO6clzTEGM/l1SfKrgrzLry8b4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
2 changes: 1 addition & 1 deletion ingest/ledgerbackend/buffered_meta_pipe_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (b *bufferedLedgerMetaReader) readLedgerMetaFromPipe() (*xdr.LedgerCloseMet
}

var xlcm xdr.LedgerCloseMeta
_, err = xlcm.DecodeFrom(b.decoder)
_, err = xlcm.DecodeFrom(b.decoder, xdr3.DecodeDefaultMaxDepth)
if err != nil {
return nil, errors.Wrap(err, "unmarshaling framed LedgerCloseMeta")
}
Expand Down
2 changes: 1 addition & 1 deletion xdr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func NewBytesDecoder() *BytesDecoder {

func (d *BytesDecoder) DecodeBytes(v DecoderFrom, b []byte) (int, error) {
d.reader.Reset(b)
return v.DecodeFrom(d.decoder)
return v.DecodeFrom(d.decoder, xdr.DecodeDefaultMaxDepth)
}

func marshalString(encoder func([]byte) string, v interface{}) (string, error) {
Expand Down
Loading

0 comments on commit 838b1c4

Please sign in to comment.