summaryrefslogtreecommitdiff
path: root/avstream/avscamera/sys/Device.cpp
diff options
context:
space:
mode:
author5an7y-Microsoft <[email protected]>2026-08-07 12:39:24 -0700
committerGitHub <[email protected]>2026-08-07 12:39:24 -0700
commite179c3fd5f69933ed8b4b6098d4e773237737664 (patch)
tree2d874660c892e2a081fc97c64f22252f16b5a9c5 /avstream/avscamera/sys/Device.cpp
parentef7c3074748ab05726c3a9161d3256118efd76e2 (diff)
parentb150e03b2e7aadab8c846eb547636b37434c396a (diff)
Merge pull request #1405 from microsoft/develop
RI develop -> main
Diffstat (limited to 'avstream/avscamera/sys/Device.cpp')
-rw-r--r--avstream/avscamera/sys/Device.cpp21
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;
}