forked from libbpf/blazesym
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential panic when reporting nom errors
We have gotten reports of a crash caused by numeric overflow when attempting to parse a Breakpad file. The reason lies in the error conversion functionality that nom provides. Specifically, the nom::error::convert_error() function expects errors with a context that derefs to an str slice. In order to fulfill that contract we convert everything to Cow<str>. However, the function also implicitly assumes that substrings belong to the same input slice. That is not the case, and cannot be easily fixed, because there is no sane way of "relocating" arbitrary byte slice after a lossy string conversion. The requirement of derefing into a str while *also* mapping to byte slices and are assumed to be subslices of each other just seems plain broken. This change imports a copy of the convert_error() function and fixes up the broken bits. The upstream issue touching on this problem is: rust-bakery/nom#1696 Signed-off-by: Daniel Müller <[email protected]>
- Loading branch information
Showing
1 changed file
with
153 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters