If the initial part of the header (‘MIME-TreeMagic’) is valid, but the
following line does not start with ‘[’ (i.e. is not a valid section
line), insert_matchlet() will be called with a NULL match pointer, and
will crash with a NULL pointer dereference.
Fix this by bailing out if a valid section line isn’t encountered before
the first insert_matchlet() call (i.e. between the header line and the
first data line).
Note that this has not been tested against a real treemagic file; the
fix is purely theoretical.
Found by scan-build.
https://bugzilla.gnome.org/show_bug.cgi?id=113075
g_content_type_guess() requires specifying a valid data length. Fixes a
segfault when running the test.
Also add an explicit check for this and return XDG_MIME_TYPE_UNKNOWN when
data_size is specified as -1, to avoid crashing.
https://bugzilla.gnome.org/show_bug.cgi?id=674452
Move all the annotations over from gobject-introspection.
They will not be used directly by the introspection scanner for now,
instead they will be extracted by a script and updated manually
until introspection is properly integrated into the glib build
2009-02-20 Alexander Larsson <alexl@redhat.com>
* gcontenttype.c:
(g_content_type_guess):
Don't ever sniff desktop files when the filename is known.
In other words, only allow desktop files with the .desktop extension
and when the filename isn't known.
This is a security precaution since desktop files can execute
arbitrary code when launched and we don't want to allow them to
try and hide as another type. There is no legit reason to not
have the .desktop extension anyway.
svn path=/trunk/; revision=7892
2008-09-16 Michael Natterer <mitch@imendio.com>
* gcontenttype.c (g_content_type_guess): can't assign the return
value of g_strdupv() to an array. Fill the array manually with
const strings instead (it is never freed anyway). Fixes the
build. Also fixed indentation.
svn path=/trunk/; revision=7501
* gcontenttype.c (g_content_type_guess): Check whether there's a '/'
at the end of the filename, and declare it a directory.
Patch by Bastien Nocera
svn path=/trunk/; revision=7491
2008-06-16 Tor Lillqvist <tml@novell.com>
Bug 538362 - Get Win32 icons back in the file chooser
* gcontenttype.c (g_content_type_get_icon): Look up the icon
corresponding to a file extension in the Registry. Patch by Hans
Breuer.
(get_registry_classes_key): Handle also REG_EXPAND_SZ type values.
2008-06-16 Tor Lillqvist <tml@novell.com>
Patches by Hans Breuer:
* glocalfile.c (is_xp_or_later): Handle compiling against older
SDK headers with missing VerifyVersionInfo(). Conditioned on
_MSC_VER, but should probably use some better test.
* glocalfile.c (g_local_file_query_filesystem_info): Don't test
uninitialised statfs_result variable on Win32.
svn path=/trunk/; revision=7049
2008-06-10 Michael Natterer <mitch@imendio.com>
* gcontenttype.c (g_content_type_get_icon): fix SEGV by not using
uninitialized memory as array index.
svn path=/trunk/; revision=6981
2008-05-17 Matthias Clasen <mclasen@redhat.com>
* gcontenttype.h:
* gcontenttype.c: (g_content_type_from_mime_type):
New function to create a content type from a mime type. (#527175,
Milan Crha)
svn path=/trunk/; revision=6906
2008-02-22 Alexander Larsson <alexl@redhat.com>
* gcontenttype.c (g_content_type_get_icon):
Look at old-style gnome mime icon names too, as many
have not moved to the new style.
svn path=/trunk/; revision=6557
2008-02-21 David Zeuthen <davidz@redhat.com>
* glocalfileinfo.c: (_g_local_file_info_get):
* gcontenttype.c:
(g_content_type_get_icon): Implement this function by
moving bits from glocalfileinfo.c
(g_content_type_get_description): Unalias before getting
description (#517687)
* gfile.c: (g_file_class_init),
(g_file_query_filesystem_info_async),
(g_file_query_filesystem_info_finish),
(query_filesystem_info_data_free),
(query_filesystem_info_async_thread),
(g_file_real_query_filesystem_info_async),
(g_file_real_query_filesystem_info_finish):
* gfile.h: Implement async version of
g_file_query_filesystem_info()
* gfileinfo.h: Add new attributes for filesystem::use-preview
* gio.symbols: Update
* gthemedicon.c: (g_themed_icon_append_name):
* gthemedicon.h: Add new new convenience function.
* gunionvolumemonitor.c: (g_union_volume_monitor_dispose),
(get_mounts), (get_volumes), (get_connected_drives),
(get_volume_for_uuid), (get_mount_for_uuid),
(g_union_volume_monitor_init), (populate_union_monitor),
(g_volume_monitor_get), (_g_mount_get_for_mount_path),
(g_volume_monitor_adopt_orphan_mount):
* gvolumemonitor.c:
* gvolumemonitor.h: Use recursive locks so it's safe for volume
monitor implementations to call into the main volume monitor. Also
separate object initialization and volume monitor initialization
such that non-native volume monitors can properly adopt their
mounts away.
svn path=/trunk/; revision=6550
2008-02-01 Michael Natterer <mitch@imendio.com>
* gcontenttype.c (_g_unix_content_type_get_parents): assign the
return value of xdg_mime_list_mime_parents() to a variable of the
correct type.
svn path=/trunk/; revision=6441