From 7518e8ba7e13e1e4d68125b968ddd6571647ee1d Mon Sep 17 00:00:00 2001 From: Bradley Furman Date: Tue, 13 Sep 2022 20:54:36 +0000 Subject: [PATCH] Updates the FB_COMMAND_SIZE from 64 to the linux max value of 4096 and updates the relevant unit tests. BUG=182864081 Test: Update the size check to the existing unit tests Change-Id: I66b08884a5228e164c22c575a6f6c82a236fece2 --- fastboot/constants.h | 2 +- fastboot/fuzzy_fastboot/main.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fastboot/constants.h b/fastboot/constants.h index b732c7601..f6fc74eda 100644 --- a/fastboot/constants.h +++ b/fastboot/constants.h @@ -42,7 +42,7 @@ #define RESPONSE_DATA "DATA" #define RESPONSE_INFO "INFO" -#define FB_COMMAND_SZ 64 +#define FB_COMMAND_SZ 4096 #define FB_RESPONSE_SZ 256 #define FB_VAR_VERSION "version" diff --git a/fastboot/fuzzy_fastboot/main.cpp b/fastboot/fuzzy_fastboot/main.cpp index 074306b32..e6359374e 100644 --- a/fastboot/fuzzy_fastboot/main.cpp +++ b/fastboot/fuzzy_fastboot/main.cpp @@ -901,19 +901,19 @@ TEST_F(Fuzz, BadCommandTooLarge) { << "Device did not respond with failure after sending length " << s.size() << " string of random ASCII chars"; if (ret == IO_ERROR) EXPECT_EQ(transport->Reset(), 0) << "USB reset failed"; - std::string s1 = RandomString(1000, rand_legal); + std::string s1 = RandomString(10000, rand_legal); ret = fb->RawCommand(s1); EXPECT_TRUE(ret == DEVICE_FAIL || ret == IO_ERROR) << "Device did not respond with failure after sending length " << s1.size() << " string of random ASCII chars"; if (ret == IO_ERROR) EXPECT_EQ(transport->Reset(), 0) << "USB reset failed"; - std::string s2 = RandomString(1000, rand_illegal); + std::string s2 = RandomString(10000, rand_illegal); ret = fb->RawCommand(s2); EXPECT_TRUE(ret == DEVICE_FAIL || ret == IO_ERROR) << "Device did not respond with failure after sending length " << s2.size() << " string of random non-ASCII chars"; if (ret == IO_ERROR) EXPECT_EQ(transport->Reset(), 0) << "USB reset failed"; - std::string s3 = RandomString(1000, rand_char); + std::string s3 = RandomString(10000, rand_char); ret = fb->RawCommand(s3); EXPECT_TRUE(ret == DEVICE_FAIL || ret == IO_ERROR) << "Device did not respond with failure after sending length " << s3.size() @@ -935,7 +935,7 @@ TEST_F(Fuzz, BadCommandTooLarge) { TEST_F(Fuzz, CommandTooLarge) { for (const std::string& s : CMDS) { - std::string rs = RandomString(1000, rand_char); + std::string rs = RandomString(10000, rand_char); RetCode ret; ret = fb->RawCommand(s + rs); EXPECT_TRUE(ret == DEVICE_FAIL || ret == IO_ERROR)