[1/2] reader: Read array subrange length into an uint64_t

Message ID 87pn3y7o0b.fsf@redhat.com
State Committed
Headers
Series Fix array subrange (de) serialization |

Commit Message

Dodji Seketeli Nov. 27, 2020, 4:39 p.m. UTC
  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(-)
  

Patch

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;