diff options
Diffstat (limited to 'avstream/avscamera/sys/Device.cpp')
| -rw-r--r-- | avstream/avscamera/sys/Device.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/avstream/avscamera/sys/Device.cpp b/avstream/avscamera/sys/Device.cpp index 38d4f555..ec969554 100644 --- a/avstream/avscamera/sys/Device.cpp +++ b/avstream/avscamera/sys/Device.cpp @@ -45,6 +45,8 @@ CCaptureDevice ( , m_FilterDescriptorCount(0) , m_Sensor(nullptr) , m_Context(nullptr) + , m_DmaAdapterObject(nullptr) + , m_NumberOfMapRegisters(0) { PAGED_CODE(); } @@ -85,9 +87,10 @@ CCaptureDevice:: GetFilterIndex(PKSFILTER Filter) { PAGED_CODE(); + ULONG i; - for( i=0; i<m_FilterDescriptorCount; i++ ) + for( i=0; i<(ULONG)m_FilterDescriptorCount; i++ ) { if( Filter->Descriptor->ReferenceGuid && IsEqualGUID(*(m_Context[i].Descriptor->ReferenceGuid), *Filter->Descriptor->ReferenceGuid)) @@ -130,13 +133,19 @@ QueryForInterface( _In_ USHORT Size, _In_ USHORT Version, _In_opt_ PVOID InterfaceSpecificData - ) +) { PAGED_CODE(); PIRP pIrp; NTSTATUS status; + // Ensure the output parameter is initialized to a known state. + if (Interface) + { + RtlZeroMemory(Interface, Size); + } + if (TopOfStack == nullptr) { return STATUS_INVALID_PARAMETER; @@ -181,7 +190,7 @@ QueryForInterface( KernelMode, FALSE, // Not alertable NULL - ); + ); status = pIrp->IoStatus.Status; } @@ -192,6 +201,12 @@ QueryForInterface( status = STATUS_INSUFFICIENT_RESOURCES; } + // If the call failed, ensure Interface is zeroed to avoid returning uninitialized memory. + if (!NT_SUCCESS(status) && Interface) + { + RtlZeroMemory(Interface, Size); + } + return status; } |
