public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applied] RHBZ1944096 - assertion failure during self comparison of systemd
Date: Wed, 08 Sep 2021 16:19:35 +0200	[thread overview]
Message-ID: <87o893f8ug.fsf@redhat.com> (raw)

Hello,

When reading the abixml representing an enumerator which value is
exactly either LLONG_MIN or LLONG_MAX, build_enum_type_decl fails
because we wrongly think that an underflow or overflow happened, while
using strtoll.

This patch fixes the condition used to detect {under,over}flow
whenusing strtoll.

	* src/abg-reader.cc (build_enum_type_decl): When strtoll detects
	an underflow or overflo, it sets errno to ERANGE.  So take that
	into account.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.

---
 src/abg-reader.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index f4fe4ce8..559f8210 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -4325,7 +4325,11 @@ build_enum_type_decl(read_context&	ctxt,
 	  if (a)
 	    {
 	      value = strtoll(CHAR_STR(a), NULL, 0);
-	      if (value == LLONG_MIN || value == LLONG_MAX)
+	      // when strtoll encounters overflow or underflow, errno
+	      // is set to ERANGE and the returned value is either
+	      // LLONG_MIN or LLONG_MAX.
+	      if ((errno == ERANGE)
+		  && (value == LLONG_MIN || value == LLONG_MAX))
 		return nil;
 	    }
 
-- 
2.30.0


-- 
		Dodji


                 reply	other threads:[~2021-09-08 14:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o893f8ug.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=libabigail@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).