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 recursion #235

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

Conversation

janstarke
Copy link

During a case, We had some issues with endless recursion (and memory consumption) with some carved evtx files. It turned out that read_open_start_element tends to call itself with a fixed cursor position to try to read corrupt data. However, if the resulting position still contains invalid data, this leads to an infinite recursion.

We tried to fix this by limiting the maximum recursion depth, but this did not solve the problem. In our case, we got an endless loop in Deserializer::inner_next, where cursor remained at one position and the byte after, and back again, and so on.

The current fix is to give the heuristics exactly one try, and if this fails, the reading of the token fails. In my eyes, no more tries should be done. In addition, we restore the original cursor position (before the heuristic call), which fixes the second problem.

With our test data, the fix is working well. Unfortunately, we cannot provide the data as test data, because they contain customer data.

Regards, Jan

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.

1 participant