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

Changes to text parser to handle decode errors #3301 #3302

Merged
merged 1 commit into from
Feb 6, 2021

Conversation

joachimmetz
Copy link
Member

@joachimmetz joachimmetz commented Nov 15, 2020

Changes to text parser to handle decode errors #3301

@joachimmetz joachimmetz added the blocked Work cannot progress until another issue is resolved label Nov 15, 2020
@joachimmetz joachimmetz requested a review from Onager November 19, 2020 19:13
@joachimmetz joachimmetz marked this pull request as ready for review November 19, 2020 19:13
@joachimmetz joachimmetz removed the blocked Work cannot progress until another issue is resolved label Nov 19, 2020
@codecov
Copy link

codecov bot commented Dec 5, 2020

Codecov Report

Merging #3302 (95cea5c) into master (a6627f4) will increase coverage by 0.00%.
The diff coverage is 92.30%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3302   +/-   ##
=======================================
  Coverage   85.94%   85.95%           
=======================================
  Files         376      376           
  Lines       32359    32372   +13     
=======================================
+ Hits        27812    27824   +12     
- Misses       4547     4548    +1     
Impacted Files Coverage Δ
plaso/parsers/text_parser.py 87.27% <92.30%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6627f4...95cea5c. Read the comment docs.

self._current_offset + exception.start))

escaped = '\\x{0:2x}'.format(exception.object[exception.start])
return (escaped, exception.start + 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be exception.end (no +1) instead? I assume start and end will be the same after a 1-byte error, but if there's multiple bytes of invalid data, wouldn't we want to resume parsing at the end of that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, I took the conservative approach to account for single byte data that might case multi byte decoding errors

plaso/parsers/text_parser.py Outdated Show resolved Hide resolved
exception.object[exception.start],
self._current_offset + exception.start))

escaped = '\\x{0:2x}'.format(exception.object[exception.start])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only handles the case of a 1-byte error, are you sure you want 1 exception message per invalid byte?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the conservative approach to account for single byte data that might case multi byte decoding errors. We could limit the number of warning that will be generated if you expect a lot of encoding errors.

@joachimmetz
Copy link
Member Author

@Onager PTAL

@joachimmetz joachimmetz removed the request for review from Onager February 6, 2021 07:32
@joachimmetz joachimmetz assigned joachimmetz and unassigned Onager Feb 6, 2021
@joachimmetz joachimmetz merged commit 0e708f4 into log2timeline:master Feb 6, 2021
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.

2 participants