author | Shuide Chen <shuide.chen@amlogic.com> | 2020-02-28 09:25:17 (GMT) |
---|---|---|
committer | sky zhou <sky.zhou@amlogic.com> | 2020-05-21 12:04:38 (GMT) |
commit | 02a3087e3263b662f46ce328c343502d6c151166 (patch) | |
tree | 90d84d0143cbe2c9aab3dd7541b9b567f57f7426 | |
parent | 0564fd8966311481ed9d1c3a548115e51258aaab (diff) | |
download | hwcomposer-02a3087e3263b662f46ce328c343502d6c151166.zip hwcomposer-02a3087e3263b662f46ce328c343502d6c151166.tar.gz hwcomposer-02a3087e3263b662f46ce328c343502d6c151166.tar.bz2 |
hwc: fix parseHdrCapabilities NPE [1/1]
PD#SWPL-17723
Problem:
the code assume that we can always get hdr info from kernel
however, this is not true in some rarely condition, such as
driver not ready
Solution:
add protection for hdr capabilities parsing
Verify:
Locally
Change-Id: I051f21740bc5c0c87e1619600b3929f9666bb58e
Signed-off-by: Shuide Chen <shuide.chen@amlogic.com>
-rw-r--r-- | common/display/ConnectorHdmi.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/display/ConnectorHdmi.cpp b/common/display/ConnectorHdmi.cpp index b8b2010..583e5a9 100644 --- a/common/display/ConnectorHdmi.cpp +++ b/common/display/ConnectorHdmi.cpp @@ -354,12 +354,12 @@ int32_t ConnectorHdmi::parseHdrCapabilities() { goto exit; } - pos = strstr(pos, "HDR10Plus Supported: "); + if (pos != NULL) pos = strstr(pos, "HDR10Plus Supported: "); if ((NULL != pos) && ('1' == *(pos + strlen("HDR10Plus Supported: ")))) { mHdrCapabilities.HDR10PlusSupported = true; } - pos = strstr(pos, "SMPTE ST 2084: "); + if (pos != NULL) pos = strstr(pos, "SMPTE ST 2084: "); if ((NULL != pos) && ('1' == *(pos + strlen("SMPTE ST 2084: ")))) { mHdrCapabilities.HDR10Supported = true; @@ -368,7 +368,7 @@ int32_t ConnectorHdmi::parseHdrCapabilities() { mHdrCapabilities.minLuminance = getLineValue(pos, "Min: "); } - pos = strstr(buf, "Hybrif Log-Gamma: "); + if (pos != NULL) pos = strstr(buf, "Hybrif Log-Gamma: "); if ((NULL != pos) && ('1' == *(pos + strlen("Hybrif Log-Gamma: ")))) { mHdrCapabilities.HLGSupported = true; } |