Open ColinIanKing opened 3 years ago
Hi Colin thanks for hte report. I'll take a look tomorrow
hi Colin, does the following code change fix this?
diff --git a/source/common/dmtable.c b/source/common/dmtable.c
index 1221540db..0f8c78695 100644
--- a/source/common/dmtable.c
+++ b/source/common/dmtable.c
@@ -187,6 +187,7 @@ static const char *AcpiDmAsfSubnames[] =
static const char *AcpiDmCedtSubnames[] =
{
"CXL Host Bridge Structure",
+ "CXL Fixed Memory Window Structure",
"Unknown Subtable Type" /* Reserved */
};
Yes that fix that issue.
I also get:
1618 case ACPI_DMT_MADT:
1619
1620 /* MADT subtable types */
1621
1622 Temp8 = *Target;
39. Condition Temp8 > ACPI_MADT_TYPE_RESERVED, taking true branch.
1623 if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1624 {
40. assignment: Assigning: Temp8 = ACPI_MADT_TYPE_RESERVED.
1625 Temp8 = ACPI_MADT_TYPE_RESERVED;
1626 }
1627
CID: Out-of-bounds read (OVERRUN)
41. overrun-local: Overrunning array AcpiDmMadtSubnames of 17 8-byte elements at element index 17 (byte offset 143) using index Temp8 (which evaluates to 17).
1628 AcpiOsPrintf (UINT8_FORMAT, *Target,
1629 AcpiDmMadtSubnames[Temp8]);
1630 break;
1631
Thanks. I'm starting to see a pattern here.
I've spent some time experimenting with compile-time assertions but it tends to add some boilerplate.. Is there any way in C to force for array initializers to require that all array elements are present during compilation?
I've used this technique in stress-ng:
#define STRESS_CONCAT(a, b) a ## b
#define STRESS_CONCAT_EXPAND(a, b) STRESS_CONCAT(a, b)
#define STRESS_ASSERT(expr) \
enum { STRESS_CONCAT_EXPAND(STRESS_ASSERT_AT_LINE_, __LINE__) = \
1 / !!(expr) };
#define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
STRESS_ASSERT(SIZEOF_ARRAY(stressors) != STRESS_MAX)
where stressors is an array, STRESS_MAX is the last item in the enum that maps to the array stressors[]
Static analysis on today's tip of acpica found a potential issue in source/common/dmtable.c - not sure if this is a false positive but I though I should flag this up: