From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH 1/2] reader: Read array subrange length into an uint64_t
Date: Fri, 27 Nov 2020 17:39:16 +0100 [thread overview]
Message-ID: <87pn3y7o0b.fsf@redhat.com> (raw)
In-Reply-To: <87wny67of6.fsf@redhat.com> (Dodji Seketeli's message of "Fri, 27 Nov 2020 17:30:21 +0100")
Hello,
We read subrange length like an integer of type 'int" today. We
should read it as an uint64_t. Fixed thus.
* src/abg-reader.cc (build_subrange_type): Change the type of
length to uint64_t and read it using strtoull.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
src/abg-reader.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index 174bb3cd..ef9b44e5 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -3841,7 +3841,7 @@ build_subrange_type(read_context& ctxt,
if (xml_char_sptr s = XML_NODE_GET_ATTRIBUTE(node, "name"))
name = CHAR_STR(s);
- size_t length = 0;
+ uint64_t length = 0;
string length_str;
bool is_infinite = false;
if (xml_char_sptr s = XML_NODE_GET_ATTRIBUTE(node, "length"))
@@ -3849,7 +3849,7 @@ build_subrange_type(read_context& ctxt,
if (string(CHAR_STR(s)) == "infinite")
is_infinite = true;
else
- length = atoi(CHAR_STR(s));
+ length = strtoull(CHAR_STR(s), NULL, 0);
}
string underlying_type_id;
--
2.29.2
--
Dodji
next prev parent reply other threads:[~2020-11-27 16:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-27 16:30 [PATCH 0/2] Fix array subrange (de) serialization Dodji Seketeli
2020-11-27 16:39 ` Dodji Seketeli [this message]
2020-11-27 16:40 ` [PATCH 2/2] Bug 26780 - Fix array subrange bounds (de)serialization Dodji Seketeli
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=87pn3y7o0b.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).