From f2d6b9af3ad07af956f9240126826244017da2f1 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 15 Mar 2012 19:14:43 -0500 Subject: [PATCH] radeon_hd: Sanitize connector_is_dp function * there is no guarentee the data in encoderExternal is valid if we don't check valid == true --- src/add-ons/accelerants/radeon_hd/connector.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/connector.cpp b/src/add-ons/accelerants/radeon_hd/connector.cpp index 1ab2c9d09d..d5b307e44d 100644 --- a/src/add-ons/accelerants/radeon_hd/connector.cpp +++ b/src/add-ons/accelerants/radeon_hd/connector.cpp @@ -734,11 +734,20 @@ connector_probe() bool connector_is_dp(uint32 connectorIndex) { - if (gConnector[connectorIndex]->type == VIDEO_CONNECTOR_DP - || gConnector[connectorIndex]->type == VIDEO_CONNECTOR_EDP - || gConnector[connectorIndex]->encoderExternal.isDPBridge == true) { + connector_info* connector = gConnector[connectorIndex]; + + // Traditional DisplayPort connector + if (connector->type == VIDEO_CONNECTOR_DP + || connector->type == VIDEO_CONNECTOR_EDP) { return true; } + + // DisplayPort bridge on external encoder + if (connector->encoderExternal.valid == true + && connector->encoderExternal.isDPBridge == true) { + return true; + } + return false; }