)\r
{\r
UINT32 Offset;\r
- UINT8* PrivateResourcePtr;\r
UINT32 Index;\r
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];\r
\r
PARSER_PARAMS (ProcessorHierarchyNodeStructureParser)\r
);\r
\r
- PrivateResourcePtr = Ptr + Offset;\r
+ // Make sure the Private Resource array lies inside this structure\r
+ if (Offset + (*NumberOfPrivateResources * sizeof (UINT32)) > Length) {\r
+ IncrementErrorCount ();\r
+ Print (\r
+ L"ERROR: Invalid Number of Private Resources. " \\r
+ L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \\r
+ L"Parsing of this structure aborted.\n",\r
+ *NumberOfPrivateResources,\r
+ Length - Offset\r
+ );\r
+ return;\r
+ }\r
+\r
Index = 0;\r
+\r
+ // Parse the specified number of private resource references or the Processor\r
+ // Hierarchy Node length. Whichever is minimum.\r
while (Index < *NumberOfPrivateResources) {\r
UnicodeSPrint (\r
Buffer,\r
PrintFieldName (4, Buffer);\r
Print (\r
L"0x%x\n",\r
- *((UINT32*) PrivateResourcePtr)\r
+ *((UINT32*)(Ptr + Offset))\r
);\r
\r
- PrivateResourcePtr += sizeof(UINT32);\r
+ Offset += sizeof (UINT32);\r
Index++;\r
}\r
}\r
0,\r
NULL,\r
ProcessorTopologyStructurePtr,\r
- 4, // Length of the processor topology structure header is 4 bytes\r
+ AcpiTableLength - Offset,\r
PARSER_PARAMS (ProcessorTopologyStructureHeaderParser)\r
);\r
\r
- if ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength) {\r
+ // Make sure the PPTT structure lies inside the table\r
+ if ((Offset + *ProcessorTopologyStructureLength) > AcpiTableLength) {\r
IncrementErrorCount ();\r
Print (\r
- L"ERROR: Invalid processor topology structure length:"\r
- L" Type = %d, Length = %d\n",\r
- *ProcessorTopologyStructureType,\r
- *ProcessorTopologyStructureLength\r
+ L"ERROR: Invalid PPTT structure length. " \\r
+ L"ProcessorTopologyStructureLength = %d. " \\r
+ L"RemainingTableBufferLength = %d. PPTT parsing aborted.\n",\r
+ *ProcessorTopologyStructureLength,\r
+ AcpiTableLength - Offset\r
);\r
- break;\r
+ return;\r
}\r
\r
PrintFieldName (2, L"* Structure Offset *");\r