-#define SECTION_SIZE(SectionHeaderPtr) \\r
- ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))\r
+//\r
+// The argument passed as the SectionHeaderPtr parameter to the SECTION_SIZE()\r
+// function-like macro below must not have side effects: SectionHeaderPtr is\r
+// evaluated multiple times.\r
+//\r
+#define SECTION_SIZE(SectionHeaderPtr) ((UINT32) ( \\r
+ (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[0] ) | \\r
+ (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[1] << 8) | \\r
+ (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[2] << 16)))\r