From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH] support: Report NULL blobs explicitly in TEST_COMPARE
Date: Fri, 03 May 2019 17:57:33 +0200 [thread overview]
Message-ID: <87ftpvr0nm.fsf@oldenburg2.str.redhat.com> (raw)
Provide an explicit diagnostic if the length is positive, and
do not just crash with a null pointer dereference. Null pointers
are only valid if the length is zero, so this can only happen with
a faulty test.
2019-05-03 Florian Weimer <fweimer@redhat.com>
* support/support_test_compare_blob.c (report_blob): Report
incorrect NULL blobs.
diff --git a/support/support_test_compare_blob.c b/support/support_test_compare_blob.c
index 5bcb03418c..00491b0df1 100644
--- a/support/support_test_compare_blob.c
+++ b/support/support_test_compare_blob.c
@@ -33,7 +33,9 @@ static void
report_blob (const char *what, const unsigned char *blob,
unsigned long int length, const char *expr)
{
- if (length > 0)
+ if (blob == NULL)
+ printf (" %s (evaluated from %s): NULL\n", what, expr);
+ else if (length > 0)
{
printf (" %s (evaluated from %s):\n", what, expr);
char *quoted = support_quote_blob (blob, length);
next reply other threads:[~2019-05-03 15:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 15:57 Florian Weimer [this message]
2019-05-03 16:53 ` [PATCH] support: Report NULL blobs explicitly in TEST_COMPARE Florian Weimer
2019-05-16 13:12 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ftpvr0nm.fsf@oldenburg2.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).