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 infinite loop bug. #182

Closed
wants to merge 1 commit into from
Closed

Fix infinite loop bug. #182

wants to merge 1 commit into from

Conversation

memnoth
Copy link

@memnoth memnoth commented Mar 9, 2018

If the parameter, old is an empty string for some reason, conditions of both for loops will be never finished. To fix the bug, added one more condition that if oldlen is 0, loops never run.

If the parameter, old is an empty string for some reason, conditions of both for
loops will be never finished. To fix the bug, added one more condition
that if oldlen is 0, loops never run.

from: (q = strstr(p, old)) != NULL
to  : (oldlen != 0) && (q = strstr(p, old)) != NULL

Edited:     src/as-utils.c
@ximion
Copy link
Owner

ximion commented Mar 25, 2018

@memnoth Did you ever hit this issue when using AppStream? Or did you find it when reading the code?
Thank you for your patch in any case, I fixed this now slightly differently, using GString (this way, AppStream has only one function to search & replace in a string).

@ximion ximion closed this in 9237a96 Mar 25, 2018
@memnoth
Copy link
Author

memnoth commented Mar 26, 2018

The bug had been up in this issue: elementary/appcenter#588
This line is related to the bug.

Thank you!

@ximion
Copy link
Owner

ximion commented Mar 26, 2018

@memnoth Oooh, very interesting! The cases you never thing would happen ^^
This warrants some special mention as a bug then, as well as a faster release of 0.12.0.

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.

None yet

2 participants