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 */
 
                total_size = acpi_gbl_aml_resource_sizes[resource->type];
 
                        return;
                }
 
+               /* Sanity check the length. It must not be zero, or we loop forever */
+
+               if (!resource_list->length) {
+                       acpi_os_printf
+                           ("Invalid zero length descriptor in resource list\n");
+                       return;
+               }
+
                /* Dump the resource descriptor */
 
                if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
 
                        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) {
 
 
        while (resource < resource_end) {
 
-               /* Sanity check the resource */
+               /* Sanity check the resource type */
 
                if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
                        status = AE_AML_INVALID_RESOURCE_TYPE;
                        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 = user_function(resource, context);