summaryrefslogtreecommitdiffstats
path: root/source/components/resources
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/resources')
-rw-r--r--source/components/resources/rscalc.c7
-rw-r--r--source/components/resources/rsdump.c9
-rw-r--r--source/components/resources/rslist.c9
-rw-r--r--source/components/resources/rsxface.c9
4 files changed, 33 insertions, 1 deletions
diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c
index 6136fc6..5c373ec 100644
--- a/source/components/resources/rscalc.c
+++ b/source/components/resources/rscalc.c
@@ -230,6 +230,13 @@ AcpiRsGetAmlLength (
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
}
+ /* Sanity check the length. It must not be zero, or we loop forever */
+
+ if (!Resource->Length)
+ {
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+ }
+
/* Get the base size of the (external stream) resource descriptor */
TotalSize = AcpiGbl_AmlResourceSizes [Resource->Type];
diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c
index 0d2636e..063be02 100644
--- a/source/components/resources/rsdump.c
+++ b/source/components/resources/rsdump.c
@@ -438,6 +438,15 @@ AcpiRsDumpResourceList (
return;
}
+ /* Sanity check the length. It must not be zero, or we loop forever */
+
+ if (!ResourceList->Length)
+ {
+ AcpiOsPrintf (
+ "Invalid zero length descriptor in resource list\n");
+ return;
+ }
+
/* Dump the resource descriptor */
if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS)
diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c
index a9fd875..80d6f78 100644
--- a/source/components/resources/rslist.c
+++ b/source/components/resources/rslist.c
@@ -199,6 +199,15 @@ AcpiRsConvertResourcesToAml (
return_ACPI_STATUS (AE_BAD_DATA);
}
+ /* Sanity check the length. It must not be zero, or we loop forever */
+
+ if (!Resource->Length)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid zero length descriptor in resource list\n"));
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+ }
+
/* Perform the conversion */
if (Resource->Type == ACPI_RESOURCE_TYPE_SERIAL_BUS)
diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c
index b107ddd..36edc81 100644
--- a/source/components/resources/rsxface.c
+++ b/source/components/resources/rsxface.c
@@ -630,7 +630,7 @@ AcpiWalkResourceBuffer (
while (Resource < ResourceEnd)
{
- /* Sanity check the resource */
+ /* Sanity check the resource type */
if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
{
@@ -638,6 +638,13 @@ AcpiWalkResourceBuffer (
break;
}
+ /* Sanity check the length. It must not be zero, or we loop forever */
+
+ if (!Resource->Length)
+ {
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+ }
+
/* Invoke the user function, abort on any error returned */
Status = UserFunction (Resource, Context);
OpenPOWER on IntegriCloud