From: Pierre Gondois <Pierre.Gondois@arm.com>
When a CmObjDesc contains multiple objects, only the first one is
parsed as the buffer doesn't progress. Fix this.
Also check that the whole buffer has been parsed with an asset.
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
---
Notes:
v3:
- New patch. [Pierre]
.../ConfigurationManagerObjectParser.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
index 84a35e831471..c1b21d24a402 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
@@ -688,6 +688,7 @@ ParseCmObjDesc (
UINT32 ObjIndex;
UINT32 ObjectCount;
INTN RemainingSize;
+ INTN Offset;
CONST CM_OBJ_PARSER_ARRAY *ParserArray;
if ((CmObjDesc == NULL) || (CmObjDesc->Data == NULL)) {
@@ -722,6 +723,7 @@ ParseCmObjDesc (
ObjectCount = CmObjDesc->Count;
RemainingSize = CmObjDesc->Size;
+ Offset = 0;
for (ObjIndex = 0; ObjIndex < ObjectCount; ObjIndex++) {
DEBUG ((
@@ -733,11 +735,21 @@ ParseCmObjDesc (
ObjectCount
));
PrintCmObjDesc (
- CmObjDesc->Data,
+ (VOID *)((UINTN)CmObjDesc->Data + Offset),
ParserArray->Parser,
ParserArray->ItemCount,
&RemainingSize,
1
);
+ if ((RemainingSize > CmObjDesc->Size) ||
+ (RemainingSize < 0))
+ {
+ ASSERT (0);
+ return;
+ }
+
+ Offset = CmObjDesc->Size - RemainingSize;
} // for
+
+ ASSERT (RemainingSize == 0);
}
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84584): https://edk2.groups.io/g/devel/message/84584
Mute This Topic: https://groups.io/mt/87608851/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-