Add error messages for ACPI tables with bad OEM and OEM Table IDs

OEM ID has a max length of 6 chars
OEM TABLE ID has a max length 0f 8 chars.
(As per the ACPI spec)
This commit is contained in:
Robert Moore 2018-04-13 09:09:46 -07:00
parent 4592154cbd
commit ca828bd156
3 changed files with 19 additions and 2 deletions

View File

@ -354,7 +354,9 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_FOUND_HERE */ "Original name creation/declaration below: ",
/* ASL_MSG_ILLEGAL_RECURSION */ "Illegal recursive call to method that creates named objects",
/* ASL_MSG_EXTERN_COLLISION */ "A name cannot be defined and declared external in the same table",
/* ASL_MSG_FOUND_HERE_EXTERN*/ "Remove one of the declarations indicated above or below:"
/* ASL_MSG_FOUND_HERE_EXTERN */ "Remove one of the declarations indicated above or below:",
/* ASL_MSG_OEM_TABLE_ID */ "Invalid OEM Table ID",
/* ASL_MSG_OEM_ID */ "Invalid OEM ID"
};
/* Table compiler */

View File

@ -357,6 +357,8 @@ typedef enum
ASL_MSG_ILLEGAL_RECURSION,
ASL_MSG_EXTERN_COLLISION,
ASL_MSG_EXTERN_FOUND_HERE,
ASL_MSG_OEM_TABLE_ID,
ASL_MSG_OEM_ID,
/* These messages are used by the Data Table compiler only */

View File

@ -1061,7 +1061,7 @@ OpnDoDefinitionBlock (
if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE)
{
AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
"Length is not exactly 4");
"Length must be exactly 4 characters");
}
for (i = 0; i < ACPI_NAME_SIZE; i++)
@ -1078,6 +1078,7 @@ OpnDoDefinitionBlock (
Child = Child->Asl.Next;
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
/*
* We used the revision to set the integer width earlier
*/
@ -1086,6 +1087,12 @@ OpnDoDefinitionBlock (
Child = Child->Asl.Next;
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
if (Child->Asl.Value.String &&
strlen (Child->Asl.Value.String) > ACPI_OEM_ID_SIZE)
{
AslError (ASL_ERROR, ASL_MSG_OEM_ID, Child,
"Length cannot exceed 6 characters");
}
/* OEM TableID */
@ -1094,6 +1101,12 @@ OpnDoDefinitionBlock (
if (Child->Asl.Value.String)
{
Length = strlen (Child->Asl.Value.String);
if (Length > ACPI_OEM_TABLE_ID_SIZE)
{
AslError (ASL_ERROR, ASL_MSG_OEM_TABLE_ID, Child,
"Length cannot exceed 8 characters");
}
Gbl_TableId = UtLocalCacheCalloc (Length + 1);
strcpy (Gbl_TableId, Child->Asl.Value.String);