[VTS 2.3] Add length check before reading blob

Adding a length check prevents the read() from
reading outside the bounds and prevents OOB crash.

Test: atest VtsHalGraphicsComposerV2_3TargetTest && atest VtsHalGraphicsComposerV2_4TargetTest
BUG: 252764300
Change-Id: I6231e340a925127f9c32ccb76768286f7292df58
Merged-In: I6231e340a925127f9c32ccb76768286f7292df58
This commit is contained in:
ramindani
2023-05-25 22:07:04 +00:00
committed by Ram Indani
parent a3f446f543
commit caee7cd3f6

View File

@@ -82,7 +82,7 @@ class ComposerCommandEngine : public V2_2::hal::ComposerCommandEngine {
std::vector<IComposerClient::PerFrameMetadataBlob> metadata;
for (size_t i = 0; i < numBlobs; i++) {
for (size_t i = 0; i < numBlobs && length >= 2; i++) {
IComposerClient::PerFrameMetadataKey key =
static_cast<IComposerClient::PerFrameMetadataKey>(readSigned());
uint32_t blobSize = read();