linux/scripts/dtc
Grant Likely 706b78f37f dtc: ensure #line directives don't consume data from the next line
Previously, the #line parsing regex ended with ({WS}+[0-9]+)?. The {WS}
could match line-break characters. If the #line directive did not contain
the optional flags field at the end, this could cause any integer data on
the next line to be consumed as part of the #line directive parsing. This
could cause syntax errors (i.e. #line parsing consuming the leading 0
from a hex literal 0x1234, leaving x1234 to be parsed as cell data,
which is a syntax error), or invalid compilation results (i.e. simply
consuming literal 1234 as part of the #line processing, thus removing it
from the cell data).

Fix this by replacing {WS} with [ \t] so that it can't match line-breaks.

Convert all instances of {WS}, even though the other instances should be
irrelevant for any well-formed #line directive. This is done for
consistency and ultimate safety.

[Cherry picked from DTC commit a1ee6f068e1c8dbc62873645037a353d7852d5cc]

Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-06-13 22:12:15 +01:00
..
libfdt dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
.gitignore
checks.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
data.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
dtc-lexer.l dtc: ensure #line directives don't consume data from the next line 2013-06-13 22:12:15 +01:00
dtc-lexer.lex.c_shipped dtc: ensure #line directives don't consume data from the next line 2013-06-13 22:12:15 +01:00
dtc-parser.tab.c_shipped dtc: Update generated files to output from Bison 2.5 2013-06-13 22:12:14 +01:00
dtc-parser.tab.h_shipped dtc: Update generated files to output from Bison 2.5 2013-06-13 22:12:14 +01:00
dtc-parser.y dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
dtc.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
dtc.h dtc: fix for_each_*() to skip first object if deleted 2012-10-17 15:53:04 -05:00
fdtdump.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
fdtget.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
fdtput.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
flattree.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
fstree.c of/flattree: Update dtc to current mainline. 2011-01-03 16:02:49 -07:00
livetree.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
Makefile script: dtc: clean generated files 2012-11-21 15:53:22 +00:00
Makefile.dtc dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
srcpos.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
srcpos.h dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
treesource.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
util.c dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
util.h dtc: import latest upstream dtc 2012-10-01 11:11:35 -05:00
version_gen.h of/flattree: Update dtc to current mainline. 2011-01-03 16:02:49 -07:00