Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(amino): stack overflow with TypeInfo.String #1180

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tbruyelle
Copy link
Contributor

@tbruyelle tbruyelle commented Sep 28, 2023

The PR just demonstrates the bug, I didn't find the fix yet

Add a test that demonstrates a bug when the underlying type represented by TypeInfo has fields of the same type: TypeInfo.String() triggers a stack overflow because the codec reuses the same TypeInfo instance when affecting the master TypeInfo.Fields.

This happens when cdc.fullnameToTypeInfo is printed (in case of error for instance see codec.go:535), causing all registered TypeInfo to be printed too, which calls their String() method.

Example of type that can triggers this issue:
tm2/pkg/crypto/merkle.SimpleProofNode

This is partly fixed by #1179, but ideally stack overflow should be fixed inside TypeInfo.String().

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

@github-actions github-actions bot added the 📦 🌐 tendermint v2 Issues or PRs tm2 related label Sep 28, 2023
@tbruyelle tbruyelle changed the title fix(amino): demo bug with TypeInfo.String fix(amino): stack overflow with TypeInfo.String Sep 28, 2023
@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (5a7d005) 47.00% compared to head (d99a462) 47.29%.
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1180      +/-   ##
==========================================
+ Coverage   47.00%   47.29%   +0.29%     
==========================================
  Files         365      367       +2     
  Lines       61156    62118     +962     
==========================================
+ Hits        28744    29377     +633     
- Misses      30058    30350     +292     
- Partials     2354     2391      +37     

see 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Add a test that demonstrates a bug when the underlying type represented
by TypeInfo has fields of the same type: TypeInfo.String() triggers a
stack overflow because the codec reuses the same TypeInfo instance when
affecting the master TypeInfo.Fields.

This happens when cdc.fullnameToTypeInfo is printed (in case of error
for instance see codec.go:535), causing all registered TypeInfo to be
printed too, which calls their String method.

Example of type that can triggers this issue:
tm2/pkg/crypto/merkle.SimpleProofNode.
@tbruyelle tbruyelle force-pushed the tbruyelle/fix/typeinfo-string branch from d99a462 to a32def1 Compare June 13, 2024 08:57
@Kouteki Kouteki added the 🐞 bug Something isn't working label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 📦 🌐 tendermint v2 Issues or PRs tm2 related
Projects
Status: To triage
Status: 🚀 Needed for Launch
Development

Successfully merging this pull request may close these issues.

2 participants