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: fatal runtime error: stack overflow when try use ArchiveIteratorBuilder.filter() #113

Conversation

alandeev
Copy link
Contributor

problem

When trying to use the "filter" function of ArchiveIteratorBuilder in "rar/zip/7z" with large amounts of files ( in my case 24 thousand ) and implement some rule in the "filter", the program ends up breaking if it doesn't "match" during thousands of files traversed, because if the "filter" does not "match" during each chunk, it calls "self.next()" again recursively to process the next chunk/header, thus filling the call stack and causing a "fatal runtime error".

solution

I removed the recursion and added a loop.

@alandeev alandeev force-pushed the fix/runtime-error-when-use-filter-in-iterator branch from 1026da3 to 0f12c41 Compare May 22, 2023 23:27
@otavio
Copy link
Member

otavio commented May 22, 2023

I noticed that the formatting error in the code has been fixed. I have sent a revised code for your review in the branch. Additionally, it would be great if you could add an item to the CHANGES.md file to document the change.

@alandeev
Copy link
Contributor Author

@otavio
OK. sorry for the problems, i'm new trying to help in open source :) I'm still getting familiar with the rules.

I will again correct the problems that occurred in the actions and a doubt I have is where can I add this change in "CHANGES.md", would it be below the "## [Unreleased] - ReleaseDate" right?

@otavio
Copy link
Member

otavio commented May 22, 2023

Yes, it'll be below it.

@otavio
Copy link
Member

otavio commented May 22, 2023

No worries, I am happy to help :-)

@otavio otavio force-pushed the fix/runtime-error-when-use-filter-in-iterator branch from d53f875 to dfcfb8b Compare May 23, 2023 00:52
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
@otavio otavio force-pushed the fix/runtime-error-when-use-filter-in-iterator branch from dfcfb8b to 8920853 Compare May 23, 2023 00:55
@otavio otavio merged commit 8e1199b into OSSystems:master May 23, 2023
13 checks passed
@otavio
Copy link
Member

otavio commented May 23, 2023

I did minor changes and squashed the commits.

@otavio
Copy link
Member

otavio commented May 23, 2023

Released 0.14.2.

@coveralls
Copy link

coveralls commented May 18, 2024

Pull Request Test Coverage Report for Build 5051902929

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-1.4%) to 83.951%

Files with Coverage Reduction New Missed Lines %
src/lib.rs 1 72.46%
Totals Coverage Status
Change from base Build 4482848134: -1.4%
Covered Lines: 340
Relevant Lines: 405

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants