Repository navigation
Commit 84ee0b7
authored
uapi16: refuse a contents object that refers to the root
A writer takes a contents object whose file is the name of the root and
writes
{"contents":[{"file":""}],"name":"x"}
which a reader refuses:
manifest object 1: contents file reference: name is empty: ''
Every name is one a reader takes for a file but the root's, which is
empty, and ContentsSource::File() can hold it: Name::ROOT,
Name::default() and the parent of a name at the top are all the name of
the root. So refuse such a contents object in ContentsObject::check(),
which checks the values of a contents object as a reader does, with the
error a reader gives for the record. That error moves into
Error::invalid_file_reference() so that the reader and the writer share
it. The message only differs in the name of the object, which a reader
doesn't know yet when it reads the contents objects.
Since the previous commit set_contents() runs ContentsObject::check()
as well, through ContentsObject::check_values(). So it now fills in
nothing from such a contents object either. Before, the file "" with
the original size 5 gave the object the size 5 and the contents object
the encoded size 5, both marked as filled in.
The sweep of the previous commit agrees once it has the name of the
root among its files. Before this change 15718 of its file objects with
one or two contents objects didn't agree with a reader, and the writer
took 9741 objects whose records a reader refuses. Now all of them agree,
and where a reader takes the record nothing changes.
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>1 parent 8a48c10 commit 84ee0b7
3 files changed
Lines changed: 76 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1862 | 1862 | | |
1863 | 1863 | | |
1864 | 1864 | | |
1865 | | - | |
1866 | | - | |
1867 | | - | |
1868 | | - | |
1869 | | - | |
1870 | | - | |
1871 | | - | |
1872 | | - | |
1873 | | - | |
1874 | | - | |
1875 | | - | |
1876 | | - | |
1877 | | - | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
1878 | 1870 | | |
1879 | 1871 | | |
1880 | 1872 | | |
| |||
3101 | 3093 | | |
3102 | 3094 | | |
3103 | 3095 | | |
3104 | | - | |
3105 | | - | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
3106 | 3099 | | |
3107 | 3100 | | |
3108 | 3101 | | |
| |||
3132 | 3125 | | |
3133 | 3126 | | |
3134 | 3127 | | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
3135 | 3136 | | |
3136 | 3137 | | |
3137 | 3138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
640 | 655 | | |
641 | 656 | | |
642 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
732 | 738 | | |
733 | 739 | | |
734 | 740 | | |
| |||
1785 | 1791 | | |
1786 | 1792 | | |
1787 | 1793 | | |
1788 | | - | |
| 1794 | + | |
1789 | 1795 | | |
1790 | 1796 | | |
1791 | 1797 | | |
| |||
1856 | 1862 | | |
1857 | 1863 | | |
1858 | 1864 | | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
1859 | 1870 | | |
1860 | 1871 | | |
1861 | 1872 | | |
| |||
1870 | 1881 | | |
1871 | 1882 | | |
1872 | 1883 | | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
1873 | 1914 | | |
1874 | 1915 | | |
1875 | 1916 | | |
| |||
0 commit comments