dbus-message: Report OOM as OOM, not InvalidArgs

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/420
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2022-09-30 15:08:20 +01:00
parent ccab882bad
commit 3c0e63c10a
2 changed files with 3 additions and 9 deletions

View File

@ -5201,6 +5201,9 @@ dbus_message_demarshal (const char *str,
return msg;
fail_corrupt:
if (loader->corruption_reason == DBUS_VALIDITY_UNKNOWN_OOM_ERROR)
goto fail_oom;
dbus_set_error (error, DBUS_ERROR_INVALID_ARGS, "Message is corrupted (%s)",
_dbus_validity_to_error_message (loader->corruption_reason));
_dbus_message_loader_unref (loader);

View File

@ -291,15 +291,6 @@ test_valid_message_blobs (void *message_name,
goto out;
}
/* TODO: Validity checking sometimes returns InvalidArgs for OOM */
if (dbus_error_has_name (&e, DBUS_ERROR_INVALID_ARGS) &&
!have_memory &&
strstr (e.message, "Out of memory") != NULL)
{
g_test_message ("Out of memory (not a problem)");
goto out;
}
g_test_message ("Parsing %s reported unexpected error %s: %s",
path, e.name, e.message);
g_test_fail ();