richardphibel / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
DistroBaker 6ff1af
From a93b0f5c9f0abef6efb5413df9e98b047a2a9a46 Mon Sep 17 00:00:00 2001
DistroBaker 6ff1af
From: Jan Kratochvil <jan.kratochvil@redhat.com>
DistroBaker 6ff1af
Date: Mon, 17 Aug 2020 16:56:56 +0200
DistroBaker 6ff1af
Subject: [PATCH 1/6] [NFC] debugedit: Protect macro arguments by parentheses
DistroBaker 6ff1af
DistroBaker 6ff1af
---
DistroBaker 6ff1af
 tools/debugedit.c | 14 +++++++-------
DistroBaker 6ff1af
 1 file changed, 7 insertions(+), 7 deletions(-)
DistroBaker 6ff1af
DistroBaker 6ff1af
diff --git a/tools/debugedit.c b/tools/debugedit.c
DistroBaker 6ff1af
index 6bea88551..a351adec8 100644
DistroBaker 6ff1af
--- a/tools/debugedit.c
DistroBaker 6ff1af
+++ b/tools/debugedit.c
DistroBaker 6ff1af
@@ -233,7 +233,7 @@ typedef struct
DistroBaker 6ff1af
   int shift = 0;			\
DistroBaker 6ff1af
   do					\
DistroBaker 6ff1af
     {					\
DistroBaker 6ff1af
-      c = *ptr++;			\
DistroBaker 6ff1af
+      c = *(ptr)++;			\
DistroBaker 6ff1af
       ret |= (c & 0x7f) << shift;	\
DistroBaker 6ff1af
       shift += 7;			\
DistroBaker 6ff1af
     } while (c & 0x80);			\
DistroBaker 6ff1af
@@ -251,7 +251,7 @@ typedef struct
DistroBaker 6ff1af
       valv >>= 7;			\
DistroBaker 6ff1af
       if (valv)				\
DistroBaker 6ff1af
 	c |= 0x80;			\
DistroBaker 6ff1af
-      *ptr++ = c;			\
DistroBaker 6ff1af
+      *(ptr)++ = c;			\
DistroBaker 6ff1af
     }					\
DistroBaker 6ff1af
   while (valv);				\
DistroBaker 6ff1af
 })
DistroBaker 6ff1af
@@ -311,7 +311,7 @@ strptr (DSO *dso, int sec, off_t offset)
DistroBaker 6ff1af
 }
DistroBaker 6ff1af
 
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-#define read_8(ptr) *ptr++
DistroBaker 6ff1af
+#define read_8(ptr) *(ptr)++
DistroBaker 6ff1af
 
DistroBaker 6ff1af
 #define read_16(ptr) ({					\
DistroBaker 6ff1af
   uint16_t ret = do_read_16 (ptr);			\
DistroBaker 6ff1af
@@ -328,13 +328,13 @@ strptr (DSO *dso, int sec, off_t offset)
DistroBaker 6ff1af
 REL *relptr, *relend;
DistroBaker 6ff1af
 int reltype;
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-#define do_read_32_relocated(ptr) ({			\
DistroBaker 6ff1af
-  uint32_t dret = do_read_32 (ptr);			\
DistroBaker 6ff1af
+#define do_read_32_relocated(xptr) ({			\
DistroBaker 6ff1af
+  uint32_t dret = do_read_32 (xptr);			\
DistroBaker 6ff1af
   if (relptr)						\
DistroBaker 6ff1af
     {							\
DistroBaker 6ff1af
-      while (relptr < relend && relptr->ptr < ptr)	\
DistroBaker 6ff1af
+      while (relptr < relend && relptr->ptr < (xptr))	\
DistroBaker 6ff1af
 	++relptr;					\
DistroBaker 6ff1af
-      if (relptr < relend && relptr->ptr == ptr)	\
DistroBaker 6ff1af
+      if (relptr < relend && relptr->ptr == (xptr))	\
DistroBaker 6ff1af
 	{						\
DistroBaker 6ff1af
 	  if (reltype == SHT_REL)			\
DistroBaker 6ff1af
 	    dret += relptr->addend;			\
DistroBaker 6ff1af
-- 
DistroBaker 6ff1af
2.18.4
DistroBaker 6ff1af