]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-message: Report OOM as OOM, not InvalidArgs
authorSimon McVittie <smcv@collabora.com>
Fri, 30 Sep 2022 14:08:20 +0000 (15:08 +0100)
committerSimon McVittie <smcv@collabora.com>
Tue, 11 Oct 2022 11:54:21 +0000 (11:54 +0000)
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/420
Signed-off-by: Simon McVittie <smcv@collabora.com>
dbus/dbus-message.c
test/message.c

index 6f2a518d473f065e1671ca858764921f14663686..b43d5f7517f0ec864bb3c64c584ba33ea9b7c3b9 100644 (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);
index 60ef113d9c0fa2248bcf30e838883665c6f8f3f9..d2c9db2b0dc301ea28f95512b348c2d98e32ac32 100644 (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 ();