diff options
author | Emilian Peev <epeev@google.com> | 2019-07-30 13:27:07 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-07-30 13:27:07 -0700 |
commit | cfc5a976af28e4666ebba17b71d06ca6bb4300e8 (patch) | |
tree | cd524d1c44ed5ba56e86e6ff9a0fbf7505cc0160 | |
parent | d2455c3e606688a0333cb32818d7e3a09ee55a5a (diff) | |
parent | 8facf7af35ae12fb6b5eb159eccbbf3b2ca49c3c (diff) | |
download | dynamic_depth-cfc5a976af28e4666ebba17b71d06ca6bb4300e8.tar.gz |
Check Android container item MIME typeandroid-mainline-10.0.0_r9android-mainline-10.0.0_r7android-mainline-10.0.0_r5android-mainline-10.0.0_r4android-mainline-10.0.0_r10android-10.0.0_r45android-10.0.0_r44android-10.0.0_r43android-10.0.0_r42android-10.0.0_r41android-10.0.0_r40android-10.0.0_r39android-10.0.0_r38android-10.0.0_r37android-10.0.0_r36android-10.0.0_r35android-10.0.0_r34android-10.0.0_r33android-10.0.0_r32android-10.0.0_r31android-10.0.0_r30android10-qpr3-s1-releaseandroid10-qpr3-releaseandroid10-qpr2-s4-releaseandroid10-qpr2-s3-releaseandroid10-qpr2-s2-releaseandroid10-qpr2-s1-releaseandroid10-qpr2-releaseandroid10-qpr1-mainline-releaseandroid10-mainline-media-releaseandroid10-d4-s1-releaseandroid10-d4-release
am: 8facf7af35
Change-Id: I9b22049ad4de49d8a71c35a847777fd002b904cc
-rw-r--r-- | internal/dynamic_depth/depth_jpeg.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/dynamic_depth/depth_jpeg.cc b/internal/dynamic_depth/depth_jpeg.cc index 396a41e..af2ead9 100644 --- a/internal/dynamic_depth/depth_jpeg.cc +++ b/internal/dynamic_depth/depth_jpeg.cc @@ -19,6 +19,7 @@ namespace dynamic_depth { int32_t ValidateAndroidDynamicDepthBuffer(const char* buffer, size_t buffer_length) { XmpData xmp_data; + std::string itemMime("image/jpeg"); const string image_data(buffer, buffer_length); ReadXmpFromMemory(image_data, /*XmpSkipExtended*/ false, &xmp_data); @@ -29,6 +30,18 @@ int32_t ValidateAndroidDynamicDepthBuffer(const char* buffer, size_t buffer_leng return -1; } + // Check the container items mime type + if ((device->GetContainer() == nullptr) || (device->GetContainer()->GetItems().empty())) { + LOG(ERROR) << "No container or container items found!"; + return -1; + } + auto items = device->GetContainer()->GetItems(); + for (const auto& item : items) { + if (item->GetMime() != itemMime) { + LOG(ERROR) << "Item MIME type doesn't match the expected value: " << itemMime; + return -1; + } + } // Check profiles const Profiles* profiles = device->GetProfiles(); if (profiles == nullptr) { |