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

Reset recursion depth for error message #3209

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

ffesti
Copy link
Contributor

@ffesti ffesti commented Jul 18, 2024

$ rpm --define 'aaa %[%aaa]' --eval '%aaa'

let to a core dump due to a stack overflow. This was cause by the generation of the error message failing due to being too deep in the recursion of the macro expansion - creating more error messages.

Resetting the depth counter allows rendering the error message. As we are failing and breaking off the parse run this is fine to do.

Thanks to Miro Hrončok for reporting

Resolves: #3197

@dmnks
Copy link
Contributor

dmnks commented Jul 19, 2024

Please add a test (which should be pretty easy for this one).

@dmnks
Copy link
Contributor

dmnks commented Jul 19, 2024

I also wonder why the change from the -- operator to -= 1, does it have some effect? I don't suppose that but it does look intentional.

$ rpm --define 'aaa %[%aaa]' --eval '%aaa'

let to a core dump due to a stack overflow. This was cause by the
generation of the error message failing due to being too deep in the
recursion of the macro expansion - creating more error messages.

Resetting the depth counter allows rendering the error message. As we are
failing and breaking off the parse run this is fine to do.

Thanks to Miro Hrončok for reporting

Resolves: rpm-software-management#3197
@ffesti
Copy link
Contributor Author

ffesti commented Jul 22, 2024

Done!

@dmnks
Copy link
Contributor

dmnks commented Jul 23, 2024

Thanks!

@dmnks dmnks merged commit ef87d25 into rpm-software-management:master Jul 23, 2024
1 check passed
@ffesti ffesti deleted the 3197 branch July 23, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault when a recursive macro contains %[expression]
2 participants