commit | ce58dc0a2ae2f9995365f8db65c44d2e885e4020 | [log] [tgz] |
---|---|---|
author | Thomas Haller <thaller@redhat.com> | Wed Feb 07 09:06:33 2024 +0100 |
committer | Thomas Haller <thaller@redhat.com> | Wed Feb 07 10:45:31 2024 +0100 |
tree | f3c2eca1681f9a69ad24d7f34cd624c12bdf8145 | |
parent | a040562d6c6163a28617ce4cf26d00e68dac2f3c [diff] |
gnulib: handle overflow and "-Werror=alloc-size-larger-than=" in convert_to_decimal() gcc-13.2.1-6.fc39 (with glibc-2.38-14.fc39) warns on x86_64: In file included from ../glib/gnulib/vasnprintf.c:60: In function ‘convert_to_decimal’, inlined from ‘scale10_round_decimal_decoded’ at ../glib/gnulib/vasnprintf.c:1296:12: ../glib/gnulib/g-gnulib.h:33:17: error: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] 33 | #define malloc g_malloc ../glib/gnulib/vasnprintf.c:867:26: note: in expansion of macro ‘malloc’ 867 | char *c_ptr = (char *) malloc (xsum (xsum (extra_zeroes, c_len), 1)); | ^~~~~~ In file included from ../glib/glist.h:34, from ../glib/ghash.h:36, from ../glib/glib.h:52, from ../glib/gnulib/g-gnulib.h:21: ../glib/gmem.h: In function ‘scale10_round_decimal_decoded’: ../glib/gmem.h:84:10: note: in a call to allocation function ‘g_malloc’ declared here 84 | gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); | ^~~~~~~~ The xsum() pattern for checking for overflow seems cumbersome. Because, you still cannot just call malloc(xsum()) with SIZE_MAX. Instead, you always need to check whether an overflow happened. A xmalloc_sum() macro would be much better. Anyway. Also, patch the fork of gnulib. That is probably undesirable, however, the gnulib fork already heavily deviated so that ship has sailed.
GLib is the low-level core library that forms the basis for projects such as GTK and GNOME. It provides data structure handling for C, portability wrappers, and interfaces for such runtime functionality as an event loop, threads, dynamic loading, and an object system.
The official download locations are: https://download.gnome.org/sources/glib
The official web site is: https://www.gtk.org/
See the file ‘INSTALL.md’. There is separate and more in-depth documentation for building GLib on Windows.
Upstream GLib only supports the most recent stable release series, the previous stable release series, and the current development release series. All older versions are not supported upstream and may contain bugs, some of which may be exploitable security vulnerabilities.
See SECURITY.md for more details.
API documentation is available online for GLib for the:
If you have a question about how to use GLib, seek help on GNOME’s Discourse instance. Alternatively, ask a question on StackOverflow and tag it glib
.
Bugs should be reported to the GNOME issue tracking system. You will need to create an account for yourself. You may also submit bugs by e-mail (without an account) by e-mailing incoming+gnome-glib-658-issue-@gitlab.gnome.org, but this will give you a degraded experience.
Bugs are for reporting problems in GLib itself, not for asking questions about how to use it. To ask questions, use one of our discussion forums.
In bug reports please include:
tests/
subdirectory, that will be most convenient. Otherwise, please include a short test program that exhibits the behavior. As a last resort, you can also provide a pointer to a larger piece of software that can be downloaded.Please follow the contribution guide to know how to start contributing to GLib.
Patches should be submitted as merge requests to gitlab.gnome.org. If the patch fixes an existing issue, please refer to the issue in your commit message with the following notation (for issue 123):
Closes: #123
Otherwise, create a new merge request that introduces the change. Filing a separate issue is not required.