diff options
author | Philip Withnall <withnall@endlessm.com> | 2018-07-30 19:10:11 +0100 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2018-07-30 21:59:26 +0100 |
commit | 376234f9b25b220ff58dafbc4ba6bfcfc37b6f34 (patch) | |
tree | f89fd45b389fa7399f477b6dd8811ffd02bd3371 /glib/tests | |
parent | 4127c84c3a8461dc456cbf4c60dc98934823cec2 (diff) | |
download | glib-376234f9b25b220ff58dafbc4ba6bfcfc37b6f34.tar.gz |
gbookmarkfile: Fix error reporting with unexpected nesting of elements
The parser state machine for bookmark files did not handle unexpected
nesting of elements, such as a <bookmark> element inside a <title>
element — it would print a critical warning rather than returning a
GError.
Fix that, and add various unit tests for it. The set of tests includes
various other general markup tests as provided by Jussi Judin.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://gitlab.gnome.org/GNOME/glib/issues/1035
Diffstat (limited to 'glib/tests')
-rw-r--r-- | glib/tests/Makefile.am | 21 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-18.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-19.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-20.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-21.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-22.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-23.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-24.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-25.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-26.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-27.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-28.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-29.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-30.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-31.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-32.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-33.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-34.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-35.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-36.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-37.xbel | 1 | ||||
-rw-r--r-- | glib/tests/bookmarks/fail-38.xbel | 1 |
22 files changed, 42 insertions, 0 deletions
diff --git a/glib/tests/Makefile.am b/glib/tests/Makefile.am index 4c822bf66..2a53ae6fd 100644 --- a/glib/tests/Makefile.am +++ b/glib/tests/Makefile.am @@ -143,6 +143,27 @@ dist_test_data += \ bookmarks/fail-15.xbel \ bookmarks/fail-16.xbel \ bookmarks/fail-17.xbel \ + bookmarks/fail-18.xbel \ + bookmarks/fail-19.xbel \ + bookmarks/fail-20.xbel \ + bookmarks/fail-21.xbel \ + bookmarks/fail-22.xbel \ + bookmarks/fail-23.xbel \ + bookmarks/fail-24.xbel \ + bookmarks/fail-25.xbel \ + bookmarks/fail-26.xbel \ + bookmarks/fail-27.xbel \ + bookmarks/fail-28.xbel \ + bookmarks/fail-29.xbel \ + bookmarks/fail-30.xbel \ + bookmarks/fail-31.xbel \ + bookmarks/fail-32.xbel \ + bookmarks/fail-33.xbel \ + bookmarks/fail-34.xbel \ + bookmarks/fail-35.xbel \ + bookmarks/fail-36.xbel \ + bookmarks/fail-37.xbel \ + bookmarks/fail-38.xbel \ bookmarks/valid-01.xbel \ bookmarks/valid-02.xbel \ bookmarks/valid-03.xbel \ diff --git a/glib/tests/bookmarks/fail-18.xbel b/glib/tests/bookmarks/fail-18.xbel new file mode 100644 index 000000000..10f3d80fb --- /dev/null +++ b/glib/tests/bookmarks/fail-18.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><title><bookmark:application c=""/><bookmark:application name=""exec=""/
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-19.xbel b/glib/tests/bookmarks/fail-19.xbel new file mode 100644 index 000000000..ab4edbb8d --- /dev/null +++ b/glib/tests/bookmarks/fail-19.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><title><mime:mime-type></mime:mime-type><bookmark:applications><bookmark:application name=""exec=""/
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-20.xbel b/glib/tests/bookmarks/fail-20.xbel new file mode 100644 index 000000000..a00e154d8 --- /dev/null +++ b/glib/tests/bookmarks/fail-20.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE<<><>>></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-21.xbel b/glib/tests/bookmarks/fail-21.xbel new file mode 100644 index 000000000..cf7fbf441 --- /dev/null +++ b/glib/tests/bookmarks/fail-21.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><title><bookmark:application e=""/><bookmark:application name=""exec=""/
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-22.xbel b/glib/tests/bookmarks/fail-22.xbel new file mode 100644 index 000000000..abc4cebfe --- /dev/null +++ b/glib/tests/bookmarks/fail-22.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><title><bookmark:application e=""/><bookmark:application name=""exec="">
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-23.xbel b/glib/tests/bookmarks/fail-23.xbel new file mode 100644 index 000000000..35324addd --- /dev/null +++ b/glib/tests/bookmarks/fail-23.xbel @@ -0,0 +1 @@ +</
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-24.xbel b/glib/tests/bookmarks/fail-24.xbel new file mode 100644 index 000000000..a8726e66e --- /dev/null +++ b/glib/tests/bookmarks/fail-24.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><title><bookmark:application n=""/><bookmark:application name=""exec="">
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-25.xbel b/glib/tests/bookmarks/fail-25.xbel new file mode 100644 index 000000000..e9bc439e9 --- /dev/null +++ b/glib/tests/bookmarks/fail-25.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><title><bookmark:applications></bookmark:applications><bookmark:groups><bookmark:group><
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-26.xbel b/glib/tests/bookmarks/fail-26.xbel new file mode 100644 index 000000000..739aca215 --- /dev/null +++ b/glib/tests/bookmarks/fail-26.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE<><>></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-27.xbel b/glib/tests/bookmarks/fail-27.xbel new file mode 100644 index 000000000..e40209515 --- /dev/null +++ b/glib/tests/bookmarks/fail-27.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"f=""><title><bookmark:application e=""/><bookmark:application name=""exec=""/
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-28.xbel b/glib/tests/bookmarks/fail-28.xbel new file mode 100644 index 000000000..131a97a40 --- /dev/null +++ b/glib/tests/bookmarks/fail-28.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE<><><>></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-29.xbel b/glib/tests/bookmarks/fail-29.xbel new file mode 100644 index 000000000..2cdcf9f1f --- /dev/null +++ b/glib/tests/bookmarks/fail-29.xbel @@ -0,0 +1 @@ +<?></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-30.xbel b/glib/tests/bookmarks/fail-30.xbel new file mode 100644 index 000000000..982ea1049 --- /dev/null +++ b/glib/tests/bookmarks/fail-30.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE<><<>><>></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-31.xbel b/glib/tests/bookmarks/fail-31.xbel new file mode 100644 index 000000000..4b46cbafd --- /dev/null +++ b/glib/tests/bookmarks/fail-31.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE<><<>>></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-32.xbel b/glib/tests/bookmarks/fail-32.xbel new file mode 100644 index 000000000..d6de333d1 --- /dev/null +++ b/glib/tests/bookmarks/fail-32.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-33.xbel b/glib/tests/bookmarks/fail-33.xbel new file mode 100644 index 000000000..a72c6ff33 --- /dev/null +++ b/glib/tests/bookmarks/fail-33.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE<><><><>></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-34.xbel b/glib/tests/bookmarks/fail-34.xbel new file mode 100644 index 000000000..88214d94e --- /dev/null +++ b/glib/tests/bookmarks/fail-34.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE<<>>></
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-35.xbel b/glib/tests/bookmarks/fail-35.xbel new file mode 100644 index 000000000..2f8fd1091 --- /dev/null +++ b/glib/tests/bookmarks/fail-35.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"m=""><title><mime:mime-type></mime:mime-type><mime:mime-type>
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-36.xbel b/glib/tests/bookmarks/fail-36.xbel new file mode 100644 index 000000000..7949a3b95 --- /dev/null +++ b/glib/tests/bookmarks/fail-36.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><title><mime:mime-type></mime:mime-type><bookmark:applications><application name=""exec="">
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-37.xbel b/glib/tests/bookmarks/fail-37.xbel new file mode 100644 index 000000000..785f3b104 --- /dev/null +++ b/glib/tests/bookmarks/fail-37.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel version="1.0"xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><title><mime:mime-type></mime:mime-type><bookmark:applications><bookmark:application name=""exec="">
\ No newline at end of file diff --git a/glib/tests/bookmarks/fail-38.xbel b/glib/tests/bookmarks/fail-38.xbel new file mode 100644 index 000000000..9ef34f3ee --- /dev/null +++ b/glib/tests/bookmarks/fail-38.xbel @@ -0,0 +1 @@ +<?><!DOCTYPE><xbel x=""/><o xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"><bookmark:application e=""/><bookmark:application name=""exec=""/
\ No newline at end of file |