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(stdlibs/io): handle potential overflow in NewSectionReader #1905

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

harry-hov
Copy link
Contributor

NewSectionReader sets remaining to maxInt64 (i.e 1<<63 - 1) in case of overflow, but it remained unused.

SectionReader.limit is always set to n+off. Utilize remaining to handle overflow.

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.

`NewSectionReader` sets `remaining` to `maxInt64` (i.e `1<<63 - 1`)
in case of overflow, but it remained unused.

`SectionReader.limit` is always set to `n+off`. Utilize `remaining`
to handle overflow.
@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Apr 9, 2024
Copy link

codecov bot commented Apr 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.74%. Comparing base (59c6d3e) to head (1dbc25b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1905   +/-   ##
=======================================
  Coverage   47.74%   47.74%           
=======================================
  Files         393      393           
  Lines       61637    61637           
=======================================
  Hits        29430    29430           
  Misses      29736    29736           
  Partials     2471     2471           

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

@thehowl
Copy link
Member

thehowl commented Apr 11, 2024

btw, this is tackled also in https://github.com/gnolang/gno/pull/1702/files#diff-e1009a028298b37b0e8ac2b58a5df9a2021cc1e7a3ce7a38872bf2f3b8cc49f3, happy to merge this first though

@harry-hov harry-hov merged commit 6cb2ab8 into gnolang:master Apr 12, 2024
187 of 189 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants