dtc/tests
David Gibson b43345039b 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 <anton@samba.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-04 22:56:39 +11:00
..
search_dir dtc: Add -i option to support search paths 2012-03-18 10:52:24 -05:00
search_dir_b dtc: Add -i option to support search paths 2012-03-18 10:52:24 -05:00
.gitignore fdt: Add a function to count strings 2015-09-30 13:16:35 +10:00
Makefile.tests fdt: Add a function to count strings 2015-09-30 13:16:35 +10:00
add_subnode_with_nops.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
addr_size_cells.c libfdt: Add helpers to read #address-cells and #size-cells 2014-05-12 16:01:09 +10:00
addresses.dts libfdt: Add helpers to read #address-cells and #size-cells 2014-05-12 16:01:09 +10:00
aliases.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
appendprop.dts libfdt: Add helpers for 64-bit integer properties 2012-06-03 09:14:13 -05:00
appendprop1.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
appendprop2.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
asm_tree_dump.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
bad-empty-ranges.dts dtc: Convert #address-cells and #size-cells related checks 2007-12-07 07:43:45 -06:00
bad-name-property.dts dtc: Convert "name" property checking to new infrastructure 2007-12-05 08:27:28 -06:00
bad-ncells.dts dtc: Migrate "one cell" checks to new framework 2007-12-06 09:15:56 -06:00
bad-octal-literal.dts Gracefully handle bad octal literals 2016-01-03 22:54:37 +11:00
bad-reg-ranges.dts dtc: Convert #address-cells and #size-cells related checks 2007-12-07 07:43:45 -06:00
bad-size-cells.dts Fix crash with poorly defined #size-cells 2015-04-30 10:55:41 +10:00
bad-string-props.dts dtc: Migrate "string property" checks to new framework 2007-12-06 09:16:28 -06:00
base01.asm Add some initial test cases. 2007-02-15 11:02:44 -06:00
base01.cmd Add some initial test cases. 2007-02-15 11:02:44 -06:00
base01.dts Remove support for the legacy DTS source file format. 2008-10-03 16:09:34 -05:00
base01.stderr Add some initial test cases. 2007-02-15 11:02:44 -06:00
boot-cpuid.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
boot-cpuid.dts dtc: Automatically pick a sensible boot_cpuid_phys 2010-02-19 08:36:23 -06:00
char_literal.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
char_literal.dts dtc: Support character literals in cell lists 2011-09-22 09:24:31 -05:00
comments-cmp.dts dtc: Fold comment handling test into testsuite 2008-02-15 08:10:14 -06:00
comments.dts dtc: Fold comment handling test into testsuite 2008-02-15 08:10:14 -06:00
data.S dtc: Make asm output more portable and add testcases 2009-02-03 08:38:01 -06:00
default-addr-size.dts dtc: Convert #address-cells and #size-cells related checks 2007-12-07 07:43:45 -06:00
del_node.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
del_property.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
delete_reinstate_multilabel.dts dtc: fix for_each_*() to skip first object if deleted 2012-10-08 09:12:24 -05:00
delete_reinstate_multilabel_ref.dts dtc: fix for_each_*() to skip first object if deleted 2012-10-08 09:12:24 -05:00
dependencies.cmp dtc: Implement -d option to write out a dependency file 2012-01-13 07:23:58 -06:00
dependencies.dts dtc: Implement -d option to write out a dependency file 2012-01-13 07:23:58 -06:00
deps_inc1.dtsi dtc: Implement -d option to write out a dependency file 2012-01-13 07:23:58 -06:00
deps_inc2.dtsi dtc: Implement -d option to write out a dependency file 2012-01-13 07:23:58 -06:00
division-by-zero.dts Prevent crash on division by zero 2016-01-03 22:27:32 +11:00
dtb_reverse.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
dtbs_equal_ordered.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
dtbs_equal_unordered.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
dtc-checkfails.sh Allow toggling of semantic checks 2012-07-08 13:45:21 -05:00
dtc-fails.sh Allow toggling of semantic checks 2012-07-08 13:45:21 -05:00
dtc-fatal.sh dtc: Remove some small bashisms from test scripts 2008-05-29 08:16:03 -05:00
dumptrees.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
dup-nodename.dts dtc: Add testcases for tree checks 2007-11-20 09:03:51 -06:00
dup-phandle.dts dtc: Add testcases for tree checks 2007-11-20 09:03:51 -06:00
dup-propname.dts dtc: Add testcases for tree checks 2007-11-20 09:03:51 -06:00
embedded_nul.dts Properly handle embedded nul delimited string lists 2014-08-08 19:17:31 +10:00
embedded_nul_equiv.dts Properly handle embedded nul delimited string lists 2014-08-08 19:17:31 +10:00
empty.dts Remove support for the legacy DTS source file format. 2008-10-03 16:09:34 -05:00
escapes.dts Remove support for the legacy DTS source file format. 2008-10-03 16:09:34 -05:00
extra-terminating-null.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
extra-terminating-null.dts Fix bug in -Odts with properties containing multiple terminating nulls 2009-11-11 07:34:01 -06:00
fdtdump-runtest.sh Add a basic test for fdtdump 2014-06-18 21:24:48 +10:00
fdtdump.dts fdtdump: Fix bug printing bytestrings with negative values 2015-07-09 13:47:19 +10:00
fdtget-runtest.sh fdtget-runtest.sh: use printf instead of /bin/echo -e 2013-01-06 16:02:42 -06:00
fdtput-runtest.sh Don't use diff to check fdt{get,put} results 2012-02-03 08:41:23 -06:00
find_property.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
get_alias.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
get_mem_rsv.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
get_name.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
get_path.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
get_phandle.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
getprop.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
incbin.bin dtc: Add support for binary includes. 2008-06-19 10:01:14 -05:00
incbin.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
incbin.dts dtc: Add support for binary includes. 2008-06-19 10:01:14 -05:00
include0.dts dtc: Testcase for /include/ directive 2008-07-14 12:07:14 -05:00
include1.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
include2.dts dtc: Testcase for /include/ directive 2008-07-14 12:07:14 -05:00
include3.dts dtc: Testcase for /include/ directive 2008-07-14 12:07:14 -05:00
include4.dts dtc: Testcase for /include/ directive 2008-07-14 12:07:14 -05:00
include5.dts dtc: Testcase for /include/ directive 2008-07-14 12:07:14 -05:00
include5a.dts libfdt: Add helpers for 64-bit integer properties 2012-06-03 09:14:13 -05:00
include6.dts dtc: Testcase for /include/ directive 2008-07-14 12:07:14 -05:00
include7.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
include8.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
integer-expressions.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
label01.dts Remove support for the legacy DTS source file format. 2008-10-03 16:09:34 -05:00
label_repeated.dts Add test for re-defining an identical label 2012-07-08 13:43:17 -05:00
line_directives.dts Fix some bugs in processing of line directives 2016-01-04 22:56:39 +11:00
lorem.txt Generate test data for fdtput more sensibly 2012-02-03 08:42:50 -06:00
mangle-layout.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
mangle-layout.supp dtc: Assorted improvements to test harness 2008-03-23 08:00:33 -05:00
minusone-phandle.dts dtc: Add testcases for tree checks 2007-11-20 09:03:51 -06:00
move_and_save.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
multilabel.dts Fix bug with references to root node 2014-05-09 20:48:49 +10:00
multilabel_merge.dts Fix bug with references to root node 2014-05-09 20:48:49 +10:00
node_check_compatible.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
node_offset_by_compatible.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
node_offset_by_phandle.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
node_offset_by_prop_value.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
nonexist-label-ref.dts dtc: Flexible tree checking infrastructure (v2) 2007-11-26 16:00:08 -06:00
nonexist-node-ref.dts dtc: Fix some lexical problems with references 2007-11-28 13:51:38 -06:00
nonexist-node-ref2.dts Add merging of labelled subnodes. This patch allows the following 2010-09-21 10:15:51 -05:00
nop_node.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
nop_property.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
nopulate.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
notfound.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
nul-in-escape.dts Fix crash on nul character in string escape sequence 2016-01-03 23:01:24 +11:00
nul-in-line-info1.dts Fix some bugs in processing of line directives 2016-01-04 22:56:39 +11:00
nul-in-line-info2.dts Fix some bugs in processing of line directives 2016-01-04 22:56:39 +11:00
obsolete-chosen-interrupt-controller.dts dtc: Convert check for obsolete /chosen property 2007-12-07 07:43:53 -06:00
open_pack.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
open_pack.supp dtc: Assorted improvements to test harness 2008-03-23 08:00:33 -05:00
parent_offset.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
path-references.c Fix bug with references to root node 2014-05-09 20:48:49 +10:00
path-references.dts Fix bug with references to root node 2014-05-09 20:48:49 +10:00
path_offset.c Add testcases for fdt_path_offset_namelen() 2015-04-07 14:41:42 +10:00
path_offset_aliases.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
phandle_format.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
prop-after-subnode.dts dtc: Generate useful error message for properties after subnodes 2007-12-05 08:27:46 -06:00
propname_escapes.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
propname_escapes.dts dtc: cpp co-existence: allow names starting with # to be escaped 2012-09-28 09:23:43 -05:00
references.c Fix bug with references to root node 2014-05-09 20:48:49 +10:00
references.dts Fix bug with references to root node 2014-05-09 20:48:49 +10:00
reg-ranges-root.dts dtc: Add a testcase for 'reg' or 'ranges' in / 2008-06-02 15:20:08 -05:00
reuse-label.dts Disallow re-use of the same label within a dts file 2010-02-23 09:04:48 -06:00
reuse-label1.dts Disallow re-use of the same label within a dts file 2010-02-23 09:04:48 -06:00
reuse-label2.dts Disallow re-use of the same label within a dts file 2010-02-23 09:04:48 -06:00
reuse-label3.dts Disallow re-use of the same label within a dts file 2010-02-23 09:04:48 -06:00
reuse-label4.dts Disallow re-use of the same label within a dts file 2010-02-23 09:04:48 -06:00
reuse-label5.dts Disallow re-use of the same label within a dts file 2010-02-23 09:04:48 -06:00
reuse-label6.dts Disallow re-use of the same label within a dts file 2010-02-23 09:04:48 -06:00
root_node.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
run_tests.sh Fix some bugs in processing of line directives 2016-01-04 22:56:39 +11:00
rw_tree1.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
search_paths.dts dtc: Add -i option to support search paths 2012-03-18 10:52:24 -05:00
search_paths_b.dts dtc: Add -i option to support search paths 2012-03-18 10:52:24 -05:00
set_name.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
setprop.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
setprop_inplace.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
sized_cells.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
sized_cells.dts dtc: Add support for variable sized elements 2011-10-11 12:58:30 -05:00
sourceoutput.dts Fix an off-by-2 error in the source output code 2014-06-18 22:49:43 +10:00
string_escapes.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
stringlist.c fdt: Add functions to retrieve strings 2015-09-30 13:26:31 +10:00
stringlist.dts fdt: Add a function to count strings 2015-09-30 13:16:35 +10:00
subnode_iterate.c libfdt: Add fdt_next_subnode() to permit easy subnode iteration 2013-04-28 07:30:49 -05:00
subnode_iterate.dts libfdt: Add fdt_next_subnode() to permit easy subnode iteration 2013-04-28 07:30:49 -05:00
subnode_offset.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
supernode_atdepth_offset.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
sw_tree1.c Fix valgrind errors in sw_tree1 2013-12-31 22:34:05 +11:00
sw_tree1.supp Fix valgrind errors in sw_tree1 2013-12-31 22:34:05 +11:00
test01.asm Add some initial test cases. 2007-02-15 11:02:44 -06:00
test01.dts Remove support for the legacy DTS source file format. 2008-10-03 16:09:34 -05:00
test01.stderr Add some initial test cases. 2007-02-15 11:02:44 -06:00
test_kernel_dts Add a script that compares an "old" and "new" dtc results. 2007-11-20 09:14:03 -06:00
test_tree1.dts dtc: Add ability to delete nodes and properties 2012-09-06 07:51:43 -05:00
test_tree1_body.dtsi Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_delete.dts dtc: Add ability to delete nodes and properties 2012-09-06 07:51:43 -05:00
test_tree1_label_noderef.dts dtc: parser: Add label while overriding nodes 2015-02-23 12:29:36 +11:00
test_tree1_merge.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_merge_labelled.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_merge_path.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong1.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong2.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong3.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong4.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong5.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong6.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong7.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong8.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
test_tree1_wrong9.dts Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
testdata.h libfdt: Add helpers for 64-bit integer properties 2012-06-03 09:14:13 -05:00
tests.h libfdt: Add helpers for 64-bit integer properties 2012-06-03 09:14:13 -05:00
tests.sh Add a basic test for fdtdump 2014-06-18 21:24:48 +10:00
testutils.c Remove duplicate assignment 2014-03-03 10:37:30 +11:00
trees.S Ensure all tests have matching reg and unit address 2013-09-20 08:49:31 +10:00
truncated_property.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
utilfdt_test.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
value-labels.c dtc/tests: don't include fdt.h prior to libfdt.h 2013-01-06 15:48:51 -06:00
value-labels.dts dtc: Add testcases for labels within values 2009-02-03 08:38:05 -06:00
zero-phandle.dts dtc: Add testcases for tree checks 2007-11-20 09:03:51 -06:00