From 5fb6a94bb9c5688a27b01cf65bdec0774b481a36 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Thu, 3 Mar 2016 12:53:06 -0600 Subject: [PATCH] hidclass.sys: Handle failure to parse preparseData. Signed-off-by: Aric Stewart Signed-off-by: Alexandre Julliard --- dlls/hidclass.sys/pnp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 24dd14024d7..5de75223a46 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -212,8 +212,16 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) } ext->preparseData = ParseDescriptor(reportDescriptor, descriptor.DescriptorList[0].wReportLength); - ext->information.DescriptorSize = ext->preparseData->dwSize; + HeapFree(GetProcessHeap(), 0, reportDescriptor); + if (!ext->preparseData) + { + ERR("Cannot parse Report Descriptor\n"); + HID_DeleteDevice(&minidriver->minidriver, device); + return STATUS_NOT_SUPPORTED; + } + + ext->information.DescriptorSize = ext->preparseData->dwSize; serial[0] = 0; status = call_minidriver(IOCTL_HID_GET_STRING, device,