forked from dgibson/dtc
-
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 some bugs in processing of line directives
In order to work with preprocessed dts files more easily, dts will parse line number information in the form emitted by cpp. Anton Blanchard (using a fuzzer) reported that including a line number directive with a nul character (a literal nul in the input file, not a \0 sequence) would cause dtc to SEGV. I spotted several more problems on examining the code: * It modified yytext in place which seems to work, but is ugly and I'm not sure if it's safe on all lex/flex versions * The regexp used in the lexer to recognize line number information accepts strings with escape characters, but it won't process these escapes. - GNU cpp at least, will generate \ escapes in line number information, at least with files containing " or \ in the name This patch reworks the handling of line number information to address these problems. \ escapes should now be handled directly. nuls in file names (either with a literal nul in the input file, or with a \0 escape sequence) are still not permitted, but will now result in a lexical error rather than a SEGV. Reported-by: Anton Blanchard <[email protected]> Signed-off-by: David Gibson <[email protected]>
- Loading branch information
Showing
5 changed files
with
29 additions
and
13 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,9 @@ | |
# 10 "qux.dts" | ||
0x12345678 | ||
>; | ||
/* | ||
* Check processing of escapes in filenames | ||
*/ | ||
# 100 "\".dts" | ||
# 200 "\\.dts" | ||
}; |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# 0 "\0" |
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