- 17 Jun, 2022 2 commits
-
-
Prevent recursion of `_xdg_mime_cache_mime_type_subclass()` with the same value of argument `mime` for the subclasses of a MIME type. This was observed in GLib as https://gitlab.gnome.org/GNOME/glib/-/issues/1875, and a backtrace of the infinite loop is here: https://gitlab.gnome.org/GNOME/glib/-/issues/1875#note_592829 . Signed-off-by:
Philip Withnall <withnall@endlessm.com>
-
In order to make xdgmime properly relocatable so that unit tests can use it without it reading and modifying the user’s actual xdgmime files, and without the need to call setenv() (and get tied up with thread safety problems), add a xdg_mime_set_dirs() method to allow the dirs to be overridden. They will still default to the values of $XDG_DATA_HOME and $XDG_DATA_DIRS. Signed-off-by:
Philip Withnall <withnall@endlessm.com>
-
- 01 Jun, 2022 1 commit
-
-
Otherwise building with VS2022 fails with: ``` Creating library D:/temp/29/.sw/out/323969/gnome.glib.gio-2.71.0.lib and object D:/temp/29/.sw/out/323969/gnome.glib.gio-2.71.0.exp xdgmime.c.4b279509.obj : error LNK2019: unresolved external symbol S_ISREG referenced in function _gio_xdg_get_mime_type_for_file xdgmimecache.c.79af418f.obj : error LNK2001: unresolved external symbol S_ISREG D:\temp\29\.sw\out\323969\gnome.glib.gio-2.71.0.dll : fatal error LNK1120: 1 unresolved externals ``` See https://gitlab.gnome.org/GNOME/glib/-/issues/2560 Signed-off-by:
Philip Withnall <pwithnall@endlessos.org>
-
- 10 May, 2022 1 commit
-
-
Philip Withnall authored
This introduces no functional changes, but should help guide static analysis. Currently, scan-build thinks that `match` could be used after being freed, because it assumes that `_xdg_mime_magic_parse_error()` could return any `XdgMimeMagicState`. See the trace here: https://gnome.pages.gitlab.gnome.org/-/glib/-/jobs/1993739/artifacts/_scan_build/meson-logs/scanbuild/2022-05-10-050755-3977-1/report-6f5f44.html#EndPath Signed-off-by:
Philip Withnall <pwithnall@endlessos.org>
-
- 05 May, 2022 1 commit
-
-
Ville Skyttä authored
-
- 30 Mar, 2022 3 commits
-
-
Bastien Nocera authored
-
This will allow using the xdgmime test programs as a meson subproject.
-
Pass the xdg-mime path to the shared-mime-info build system so that it actually uses our newly built binaries. This was always broken since shared-mime-info started using xdgmime as a submodule before xdgmime had a CI.
-
- 19 Jan, 2022 1 commit
-
-
Pablo Correa Gomez authored
-
- 13 Dec, 2021 1 commit
-
-
StefanBruens authored
Commit 7cc63be3 ("Makefile: Add support for POSIX make) changed the compilation mode to strict ISO C99 (-std=c99), which removed the declarations of strdup and strcasecmp. As the implicit return value is int instead of char*, the upper address bytes are discarded on e.g. x86_64 (sizeof(int) == 4), the resulting code crashes. Add the declarations back by using Posix 2008 mode, and also include strings.h where required for strcasecmp. Compilation may still fail when the compiler binary is not available as c99, .POSIX mode sets CC=c99. Use e.g. "CC=cc make all" to circumvent.
-
- 26 Oct, 2021 1 commit
-
-
Issam E. Maghni authored
-
- 11 Oct, 2021 1 commit
-
-
Igor Kushnir authored
This change should prevent test file omissions like the one fixed in shared-mime-info@66c73d06 Always print summary. The condition (error > 0 || failed > 0) was incomplete: xmatch > 0 should have been checked as well. shared-mime-info's test_mime.sh passes a list with many expected failures to test-mime-data, so the condition failed > 0 is always true. Therefore printing the summary unconditionally makes no difference, unless there are other users of test-mime-data that don't have expected failures in their test case lists.
-
- 07 Oct, 2021 1 commit
-
-
Egor Bychin authored
-
- 28 Sep, 2021 1 commit
-
-
- 27 Sep, 2021 1 commit
-
-
Signed-off-by:
Philip Withnall <pwithnall@endlessos.org> Fixes: #9
-
- 13 Apr, 2021 1 commit
-
-
The function pointer casts silence the compiler and allow the code to build (and even run in the typical case). However, when building with control flow integrity checks, the runtime (rightfully) complains about calling a function via a mismatched function pointer type.
-
- 18 Mar, 2021 1 commit
-
-
shared-mime-info-2.1/xdgmime/src/print-mime-data.c:66: alloc_fn: Storage is returned from allocation function "fopen". shared-mime-info-2.1/xdgmime/src/print-mime-data.c:66: var_assign: Assigning: "file" = storage returned from "fopen(filename, "r")". shared-mime-info-2.1/xdgmime/src/print-mime-data.c:80: leaked_storage: Variable "file" going out of scope leaks the storage it points to. 78| { 79| printf ("Failed to allocate memory for file %s\n", filename); 80|-> return; 81| } 82| shared-mime-info-2.1/xdgmime/src/test-mime-data.c:113: alloc_fn: Storage is returned from allocation function "fopen". shared-mime-info-2.1/xdgmime/src/test-mime-data.c:113: var_assign: Assigning: "file" = storage returned from "fopen(path, "r")". shared-mime-info-2.1/xdgmime/src/test-mime-data.c:131: leaked_storage: Variable "file" going out of scope leaks the storage it points to. 129| error++; 130| 131|-> return; 132| } 133|
-
- 06 Jan, 2021 1 commit
-
-
Bastien Nocera authored
-
- 04 Jan, 2021 11 commits
-
-
Emmanuel Fleury authored
xdgmimecache.c: In function ‘dump_glob_node’: xdgmimecache.c:1064:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 1064 | for (i = 0; i < n_children; i++) | ^ xdgmimecache.c: In function ‘_xdg_test_cache_glob_dump’: xdgmimecache.c:1082:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 1082 | for (j = 0; j < n_entries; j++) | ^
-
Emmanuel Fleury authored
src/xdgmimecache.c: In function ‘__gio_xdg_cache_list_mime_parents’: src/xdgmimecache.c:1021:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 1021 | for (j = 0; j < n_entries; j++) | ^ src/xdgmimecache.c:1031:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 1031 | for (k = 0; k < n_parents && p < 127; k++) | ^
-
Emmanuel Fleury authored
src/xdgmimecache.c: In function ‘__gio_xdg_cache_mime_type_subclass’: src/xdgmimecache.c:968:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 968 | for (j = 0; j < n_parents; j++) | ^
-
Emmanuel Fleury authored
src/xdgmimecache.c: In function ‘cache_glob_node_lookup_suffix’: src/xdgmimecache.c:532:37: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 532 | while (n < n_mime_types && i < n_children) | ^
-
Emmanuel Fleury authored
src/xdgmimecache.c: In function ‘cache_glob_lookup_fnmatch’: src/xdgmimecache.c:453:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 453 | for (j = 0; j < n_entries && n < n_mime_types; j++) | ^
-
Emmanuel Fleury authored
src/xdgmimecache.c: In function ‘cache_magic_compare_to_data’: src/xdgmimecache.c:260:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 260 | for (i = 0; i < n_matchlets; i++) | ^
-
Emmanuel Fleury authored
src/xdgmimecache.c: In function ‘cache_magic_matchlet_compare’: src/xdgmimecache.c:235:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 235 | for (i = 0; i < n_children; i++) | ^
-
Emmanuel Fleury authored
src/xdgmimecache.c: In function ‘cache_magic_matchlet_compare_to_data’: src/xdgmimecache.c:181:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 181 | for (i = range_start; i < range_start + range_length; i++) | ^ src/xdgmimecache.c:190:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 190 | for (j = 0; j < data_length; j++) | ^ src/xdgmimecache.c:202:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’} 202 | for (j = 0; j < data_length; j++) | ^
-
Emmanuel Fleury authored
src/xdgmimemagic.c: In function ‘_xdg_mime_magic_matchlet_compare_to_data’: src/xdgmimemagic.c:527:32: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ 527 | for (i = matchlet->offset; i < matchlet->offset + matchlet->range_length; i++) | ^ src/xdgmimemagic.c:536:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ 536 | for (j = 0; j < matchlet->value_length; j++) | ^ src/xdgmimemagic.c:548:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ 548 | for (j = 0; j < matchlet->value_length; j++) | ^
-
Emmanuel Fleury authored
src/xdgmimemagic.c: In function ‘_xdg_mime_magic_parse_magic_line’: src/xdgmimemagic.c:406:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ 406 | if (bytes_read != matchlet->value_length) | ^~ src/xdgmimemagic.c:426:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ 426 | if (bytes_read != matchlet->value_length) | ^~ src/xdgmimemagic.c:464:34: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ 464 | if (matchlet->range_length == -1) | ^~ src/xdgmimemagic.c:488:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ 488 | for (i = 0; i < matchlet->value_length; i = i + matchlet->word_size) | ^
-
Emmanuel Fleury authored
src/xdgmimeint.c: In function ‘_xdg_binary_or_text_fallback’: src/xdgmimeint.c:195:28: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} 195 | for (i = 0; i < 128 && i < len; ++i) | ^
-
- 30 Dec, 2020 1 commit
-
-
David Faure authored
If the result from magic sniffing doesn't correspond to any of the matching globs (even via inheritance), and there *were* matching globs, then don't return the result from magic sniffing. This is too unreliable, and contradicts the fact that if there was just one glob, the glob would win (not the magic). So in that case, fallback to one of the glob matches. This required removing the code in cache_magic_lookup_data which "cleans up" the mimetypes list (from glob matches) of any glob that doesn't have matching magic. This behaviour isn't in the spec [1], and prevents having anything to fall back to in the end, after noticing that the magic should be ignored after all. [1] https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.21.html#idm45992893989040 Context: shared-mime-info#138
-
- 27 Dec, 2020 1 commit
-
-
David Faure authored
-
- 03 Jun, 2019 1 commit
- 19 Nov, 2018 1 commit
-
-
Ville Skyttä authored
-
- 17 Jul, 2018 7 commits
-
-
Kalev noted in https://gitlab.gnome.org/GNOME/glib/commit/be7f40185fb2ce884112c1f8a4b196ea65350466 that we have a buffer underflow here in case the length of the MIME type is less than two (in which case we wind up accessing negative indices of the mime string). https://bugzilla.gnome.org/show_bug.cgi?id=708529 https://bugs.freedesktop.org/show_bug.cgi?id=100733
-
As noted by Alexandru Pandelea in https://gitlab.gnome.org/GNOME/glib/commit/eb7b796bd206c31e336c89fb828a8a343ffb34ba the inode/* mime types are not subclasses of application/octet-stream, unlike all other mime types. The code is missing this check. https://bugs.freedesktop.org/show_bug.cgi?id=100733
-
As noted by Colin in https://gitlab.gnome.org/GNOME/glib/commit/2542b6f60492fadfb21f2c4a29976c3494c7e6c5 we must handle EINTR when calling open(). https://bugs.freedesktop.org/show_bug.cgi?id=100733
-
This just adds a missing free that Matthias noticed seven years ago in https://gitlab.gnome.org/GNOME/glib/commit/83d34f630939aa13539e03895bef87da738c4127 https://bugs.freedesktop.org/show_bug.cgi?id=100733
-
Pointer arithmetic has an undefined behaviour under most compilers. This wasn't a problem for us as we mostly targeted GCC, which has a defined behaviour. Quiet that warning by casting the pointer before doing operations on it. https://bugs.webkit.org/show_bug.cgi?id=171026 https://bugs.freedesktop.org/show_bug.cgi?id=100733
-
Here we free data right before passing it to _xdg_binary_or_text_fallback(), which is not good. This fix aligns the code with _xdg_mime_cache_get_mime_type_for_file(), where it is duplicated but without this bug. This commit is based on a patch to Chromium's xdgmime from https://codereview.chromium.org/1037023002 https://bugs.freedesktop.org/show_bug.cgi?id=100733
-