public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] libebl: ebl_object_note print 32bit annobin address ranges correctly
@ 2024-02-21 20:59 Mark Wielaard
  2024-02-27 14:58 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2024-02-21 20:59 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

Annobin address ranges were always printed as if they were 64bit wide
because addr_size was set to twice the size. This was done because the
note description size should contain two addresses. Fix this by setting
the address size to just one address and then check that descsz is
twice that.

	* libebl/eblobjnote.c (ebl_object_note): Set addr_size to one
	ELF_T_ADDR. Check descsz equals two times addr_size.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libebl/eblobjnote.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
index 5a7c5c62..1ba5d8b3 100644
--- a/libebl/eblobjnote.c
+++ b/libebl/eblobjnote.c
@@ -155,8 +155,8 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
 	      } addrs;
 
 	      size_t addr_size = gelf_fsize (ebl->elf, ELF_T_ADDR,
-					     2, EV_CURRENT);
-	      if (descsz != addr_size)
+					     1, EV_CURRENT);
+	      if (descsz != addr_size * 2)
 		printf ("<unknown data>\n");
 	      else
 		{
-- 
2.39.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libebl: ebl_object_note print 32bit annobin address ranges correctly
  2024-02-21 20:59 [PATCH] libebl: ebl_object_note print 32bit annobin address ranges correctly Mark Wielaard
@ 2024-02-27 14:58 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2024-02-27 14:58 UTC (permalink / raw)
  To: elfutils-devel

Hi,

On Wed, 2024-02-21 at 21:59 +0100, Mark Wielaard wrote:
> Annobin address ranges were always printed as if they were 64bit wide
> because addr_size was set to twice the size. This was done because the
> note description size should contain two addresses. Fix this by setting
> the address size to just one address and then check that descsz is
> twice that.
> 
> 	* libebl/eblobjnote.c (ebl_object_note): Set addr_size to one
> 	ELF_T_ADDR. Check descsz equals two times addr_size.

After a quick chat with Aaron on irc I pushed this.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-27 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 20:59 [PATCH] libebl: ebl_object_note print 32bit annobin address ranges correctly Mark Wielaard
2024-02-27 14:58 ` Mark Wielaard

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).