dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
4bff0a
From f6af2bfe4b353b25a61c362c3ada9be06c8f15c9 Mon Sep 17 00:00:00 2001
4bff0a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
4bff0a
Date: Fri, 3 Aug 2018 18:05:27 +0200
4bff0a
Subject: [PATCH] bus-message: output debug information about offset troubles
4bff0a
4bff0a
(cherry picked from commit 0b4775b52747bebf7ecb62062798475629767044)
4bff0a
4bff0a
Resolves: #1696224
4bff0a
---
4bff0a
 src/libsystemd/sd-bus/bus-message.c | 5 ++++-
4bff0a
 1 file changed, 4 insertions(+), 1 deletion(-)
4bff0a
4bff0a
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
4bff0a
index 153cdf933b..09e72d89dd 100644
4bff0a
--- a/src/libsystemd/sd-bus/bus-message.c
4bff0a
+++ b/src/libsystemd/sd-bus/bus-message.c
4bff0a
@@ -3845,8 +3845,11 @@ static int build_struct_offsets(
4bff0a
                                         x = size - (n_variable * sz);
4bff0a
 
4bff0a
                                 offset = m->rindex + x;
4bff0a
-                                if (offset < start)
4bff0a
+                                if (offset < start) {
4bff0a
+                                        log_debug("For type %s with alignment %zu, message specifies offset %zu which is smaller than previous end %zu + alignment = %zu",
4bff0a
+                                                  t, align, offset, previous, start);
4bff0a
                                         return -EBADMSG;
4bff0a
+                                }
4bff0a
                         } else
4bff0a
                                 /* Fixed size */
4bff0a
                                 offset = start + k;