glib/gobject
Philip Withnall 4b7f6ffe4c
gparamspecs: Fix NULL pointer dereference
I’m not sure exactly how this code is supposed to work, so this might
not be the right fix. But there’s definitely a problem here, and it was
spotted by scan-build.

If `param_value_array_validate()` is entered with
`value->data[0].v_pointer == NULL && aspec->fixed_n_elements`, that `NULL`
will be stored in `value_array` too. `value->data[0].v_pointer` will
then be set to a new non-`NULL` array.

A few lines down, `value_array_ensure_size()` is called on
`value_array` – which is still `NULL` – and this results in a `NULL`
pointer dereference.

It looks like `value->data[0].v_pointer` and `value_array` are used
interchangeably throughout the whole of the function, so assign the new
value of `value->data[0].v_pointer` to `value_array` too.

My guess is that `value_array` is just a convenience alias for
`value->data[0].v_pointer`, because the latter is a real mouthful to
type or read.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #1767
2024-04-12 18:46:13 +01:00
..
tests tests: Mark several additional tests as can_fail on GNU Hurd 2024-03-19 13:01:26 +00:00
gatomicarray.c GAtomicArray: Ensure metadata does not misalign the payload 2023-01-29 12:36:06 +00:00
gatomicarray.h GAtomicArray: Ensure metadata does not misalign the payload 2023-01-29 12:36:06 +00:00
gbinding.c Remove all nicks and blurbs from param specs 2023-11-29 13:41:34 +00:00
gbinding.h docs: Move the GBinding SECTION 2023-10-16 23:34:04 +01:00
gbindinggroup.c Remove all nicks and blurbs from param specs 2023-11-29 13:41:34 +00:00
gbindinggroup.h docs: Move the GBindingGroup SECTION 2023-10-16 23:34:20 +01:00
gboxed.c Add boxed GType for GRand 2023-12-31 09:09:48 +00:00
gboxed.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gclosure.c GType: introduce GTYPE_TO_POINTER/GPOINTER_TO_TYPE 2023-10-25 12:01:02 +01:00
gclosure.h docs: Move the GClosure SECTION 2023-10-16 23:35:05 +01:00
genums.c docs: Move enum type documentation to Markdown 2023-10-11 14:01:29 +01:00
genums.h genums: use g_once_init_enter_pointer for GType initializers 2024-01-15 17:32:11 -08:00
glib-enumtypes.c.template gobject: use g_once_init_enter_pointer for GType initializers 2023-10-04 14:50:54 +01:00
glib-enumtypes.h.template Revert "meson: Use gnome.mkenum_simple()" 2022-11-24 12:06:10 +00:00
glib-genmarshal.in Use the python found by meson as the interpreter for installed scripts 2024-03-25 15:17:59 -04:00
glib-mkenums.in Use the python found by meson as the interpreter for installed scripts 2024-03-25 15:17:59 -04:00
glib-types.h Add boxed GType for GRand 2023-12-31 09:09:48 +00:00
gmarshal.c Replace all uses of G_VA_COPY with Standard C va_copy 2022-10-26 18:07:55 +01:00
gmarshal.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gobject_gdb.py gobject_gdb.py: Do not break bt on optimized build 2023-12-12 17:30:01 +00:00
gobject_probes.d Add missing semicolons to gobject_probes.d 2012-10-15 19:48:44 -04:00
gobject_trace.h Add SPDX license headers for LGPL-2.1-or-later to various files 2022-06-01 12:44:23 +01:00
gobject-autocleanups.h Ignore autocleanups when generating introspection data 2023-10-23 10:25:30 +01:00
gobject-query.c Merge branch 'more-spdx' into 'main' 2022-07-05 11:06:49 +00:00
gobject.c docs: Fix g_object_connect()'s docblock 2024-04-08 12:05:31 +00:00
gobject.h docs: Move the GObject SECTION 2023-10-16 23:34:24 +01:00
gobject.rc.in meson: build Windows resource files 2018-01-04 22:19:30 +01:00
gobject.stp.in stp: add code comment to gobject.object_unref about object being dangling 2023-12-30 00:20:17 +01:00
gobjectnotifyqueue.c Replace most GObject warnings with criticals 2022-08-09 13:18:47 -05:00
gparam.c docs: spelling and grammar fixes 2024-04-01 11:01:06 +00:00
gparam.h Add destructor for GParamSpecPool 2023-12-19 18:41:02 +00:00
gparamspecs.c gparamspecs: Fix NULL pointer dereference 2024-04-12 18:46:13 +01:00
gparamspecs.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gsignal.c docs: Document that signal connection functions cannot fail 2024-03-07 13:12:07 +00:00
gsignal.h docs: Document that signal connection functions cannot fail 2024-03-07 13:12:07 +00:00
gsignalgroup.c Remove all nicks and blurbs from param specs 2023-11-29 13:41:34 +00:00
gsignalgroup.h docs: Move the GSignalGroup SECTION 2023-10-16 23:34:44 +01:00
gsourceclosure.c gobject: use g_once_init_enter_pointer for GType initializers 2023-10-04 14:50:54 +01:00
gsourceclosure.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gtype-private.h Merge branch 'more-spdx' into 'main' 2022-07-05 11:06:49 +00:00
gtype.c Change GType print placeholders to G_GUINTPTR_FORMAT 2023-10-25 12:01:02 +01:00
gtype.h docs: spelling and grammar fixes 2024-04-01 11:01:06 +00:00
gtypemodule.c gtypemodule: Add assertions in finalize() 2023-12-21 18:25:36 +01:00
gtypemodule.h docs: Move the GTypeModule SECTION 2023-10-16 23:34:59 +01:00
gtypeplugin.c gobject: Fix invalid doc links 2023-10-23 11:26:53 +01:00
gtypeplugin.h docs: Move the GTypePlugin SECTION 2023-10-16 23:34:53 +01:00
gvalue.c docs: Move GValue documentation to Markdown 2023-10-11 14:01:29 +01:00
gvalue.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gvaluearray.c docs: spelling and grammar fixes 2024-04-01 11:01:06 +00:00
gvaluearray.h docs: Move the GValueArray SECTION 2023-10-16 23:34:39 +01:00
gvaluecollector.h docs: Move the value collection documentation to Markdown 2023-10-23 13:18:13 +01:00
gvaluetransform.c Add SPDX license headers for LGPL-2.1-or-later to various files 2022-06-01 12:44:23 +01:00
gvaluetypes.c gvalue: add g_value_steal_string() 2023-11-04 10:40:30 +00:00
gvaluetypes.h gvalue: add g_value_steal_string() 2023-11-04 10:40:30 +00:00
libgobject-gdb.py.in Rename gdb macros with _gdb suffix to avoid ns clashes 2016-05-23 10:52:10 -04:00
meson.build Use the python found by meson as the interpreter for installed scripts 2024-03-25 15:17:59 -04:00