OSDN Git Service

CEC: Do null/empty check against the parameter for checkRecordSource()
authorJinsuk Kim <jinsukkim@google.com>
Thu, 29 Jan 2015 07:28:37 +0000 (16:28 +0900)
committerJinsuk Kim <jinsukkim@google.com>
Thu, 29 Jan 2015 07:28:37 +0000 (16:28 +0900)
This prevents out-of-bound exception from occurring.

Bug: 19188370
Change-Id: I051dccf7760cb542ea3dc9b0adc9625fa2ad8b1f

core/java/android/hardware/hdmi/HdmiRecordSources.java

index 922b8e7..7e94b89 100644 (file)
@@ -759,6 +759,8 @@ public final class HdmiRecordSources {
      */
     @SystemApi
     public static boolean checkRecordSource(byte[] recordSource) {
+        if (recordSource == null || recordSource.length == 0) return false;
+
         int recordSourceType = recordSource[0];
         int extraDataSize = recordSource.length - 1;
         switch (recordSourceType) {