ACK: [PATCH] lib: fwts_acpi_tables: fix parsing of empty data (LP: #1281197)

Alex Hung alex.hung at canonical.com
Tue Feb 18 07:27:58 UTC 2014


On 02/18/2014 01:26 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Acpi data as generated by the acpidump tool or fwts --dump with zero
> data on a line can cause the parser to segfault if the data offset
> is legitimate and the data isn't and the data is the first entry in the
> table.  This occurred on some test tables that had got corrupted. The
> fix is to break when we find no legitimate data.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_acpi_tables.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index ca3b34a..0a656cd 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -423,6 +423,8 @@ static uint8_t *fwts_acpi_load_table_from_acpidump(FILE *fp, char *name, uint64_
>   			break;
>
>   		len += (n - 1);
> +		if (len == 0)
> +			break;	/* No data, must be corrupt input */
>   		if ((new_tmp = realloc(tmp, len)) == NULL) {
>   			free(tmp);
>   			return NULL;
>

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list