tests: Add tests for the thumbnail verification code in GIO
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Thu, 24 Oct 2013 11:09:27 +0000 (12:09 +0100)
committerRyan Lortie <desrt@desrt.ca>
Thu, 24 Oct 2013 17:55:33 +0000 (13:55 -0400)
commitfcd2f7e63923853e113500e48005d269291cf391
tree7666cff78b61d35a1c6c9d0a5b3795a4b6eb1fac
parented6ca39d3bb3e23c332a5de2b2efbde0d8db21f0
tests: Add tests for the thumbnail verification code in GIO

This code was added for use by the G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID
file attribute, but may end up being used elsewhere (e.g. in GVfs) as well.
As it’s dealing with untrusted external files, and the non-trivial PNG file
format, this commit adds several test cases to cover valid and invalid PNG
files.

The security model for the thumbnail verification code is that the user’s
cache directory is untrusted, and potentially any PNG file which is passed
to the verifier has been manipulated arbitrarily by an attacker.

This is a follow-up to commit fe7069749fe39a006985ec266260a3c02ee8c855.

https://bugzilla.gnome.org/show_bug.cgi?id=709898
14 files changed:
gio/tests/.gitignore
gio/tests/Makefile.am
gio/tests/thumbnail-verification.c [new file with mode: 0644]
gio/tests/thumbnails/bad-header.png [new file with mode: 0644]
gio/tests/thumbnails/empty-key.png [new file with mode: 0644]
gio/tests/thumbnails/header-and-chunk-size.png [new file with mode: 0644]
gio/tests/thumbnails/header-only.png [new file with mode: 0644]
gio/tests/thumbnails/huge-chunk-size.png [new file with mode: 0644]
gio/tests/thumbnails/mtime-zero.png [new file with mode: 0644]
gio/tests/thumbnails/no-text-data.png [new file with mode: 0644]
gio/tests/thumbnails/overlong-value.png [new file with mode: 0644]
gio/tests/thumbnails/uri-mismatch.png [new file with mode: 0644]
gio/tests/thumbnails/valid-no-size.png [new file with mode: 0644]
gio/tests/thumbnails/valid.png [new file with mode: 0644]