[PATCH] bfd: Fix minor bug in read_indexed_address function.

Potharla, Rupesh Rupesh.Potharla@amd.com
Fri Aug 26 17:57:43 GMT 2022


[Public]


Hi,


read_indexed_address function is using offset_size instead of addr_size while reading addrx forms. Can you review my code changes and send in your comments/suggestions?


Patch Inlined:
------------------
---
bfd/dwarf2.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 69d30216771..6e5d40b8241 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1412,7 +1412,7 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
                     &file->dwarf_addr_buffer, &file->dwarf_addr_size))
     return 0;

-  if (_bfd_mul_overflow (idx, unit->offset_size, &offset))
+  if (_bfd_mul_overflow (idx, unit->addr_size, &offset))
     return 0;

   offset += unit->dwarf_addr_offset;
@@ -1423,9 +1423,9 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)

   info_ptr = file->dwarf_addr_buffer + offset;

-  if (unit->offset_size == 4)
+  if (unit->addr_size == 4)
     return bfd_get_32 (unit->abfd, info_ptr);
-  else if (unit->offset_size == 8)
+  else if (unit->addr_size == 8)
     return bfd_get_64 (unit->abfd, info_ptr);
   else
     return 0;
--

Regards,
Rupesh P
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bfd-Fix-minor-bug-in-read_indexed_address-function.patch
Type: application/octet-stream
Size: 1240 bytes
Desc: 0001-bfd-Fix-minor-bug-in-read_indexed_address-function.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20220826/6bd52645/attachment.obj>


More information about the Binutils mailing list