Bug 99759

Summary: dbus-send: Handle OOM failures by aborting
Product: dbus Reporter: Philip Withnall <bugzilla>
Component: coreAssignee: D-Bus Maintainers <dbus>
Status: RESOLVED FIXED QA Contact: D-Bus Maintainers <dbus>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: review+
i915 platform: i915 features:
Attachments: dbus-send: Handle OOM failures by aborting

Description Philip Withnall 2017-02-10 11:24:46 UTC
Fix a Coverity bug *and* a FIXME comment in one fell swoop by pointlessly handling the almost-impossible case of OOM happening in dbus-send. Sigh.
Comment 1 Philip Withnall 2017-02-10 11:24:48 UTC
Created attachment 129476 [details] [review]
dbus-send: Handle OOM failures by aborting

This is a fairly pointless feature to add, since the current behaviour
was to abort due to a NULL pointer dereference shortly after the OOM
failure. At least now people will get a helpful error message when they
try to use dbus-send on a machine with incurable memory pressure.

Coverity ID: 54710

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 2 Simon McVittie 2017-02-10 12:01:50 UTC
Comment on attachment 129476 [details] [review]
dbus-send: Handle OOM failures by aborting

Review of attachment 129476 [details] [review]:
-----------------------------------------------------------------

::: tools/dbus-send.c
@@ +155,5 @@
>        fprintf (stderr, "%s: Unsupported data type %c\n", appname, (char) type);
>        exit (1);
>      }
> +
> +  handle_oom (ret);

You could use

if (!ret)
  tool_oom ("building arguments");

by adding tool-common.[ch]. But no big deal either way really.
Comment 3 Simon McVittie 2017-02-13 16:42:12 UTC
Fixed in git for 1.11.10, thanks

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.