@@ -131,23 +131,6 @@ namespace {
131131 Timer calibrationsVeWriteTimer;
132132}
133133
134- #if 0
135- static void printScatterList(TsChannelBase* tsChannel) {
136- efiPrintf("Scatter list (global)");
137- for (size_t i = 0; i < TS_SCATTER_OFFSETS_COUNT; i++) {
138- uint16_t packed = tsChannel->highSpeedOffsets[i];
139- uint16_t type = packed >> 13;
140- uint16_t offset = packed & 0x1FFF;
141-
142- if (type == 0)
143- continue;
144- size_t size = 1 << (type - 1);
145-
146- efiPrintf("%02d offset 0x%04x size %d", i, offset, size);
147- }
148- }
149- #endif
150-
151134/* 1S */
152135#define TS_COMMUNICATION_TIMEOUT TIME_MS2I (1000 )
153136/* 10mS when receiving byte by byte */
@@ -270,11 +253,6 @@ static bool validateOffsetCount(size_t page, size_t offset, size_t count) {
270253 efiPrintf (" TS: Project mismatch? Too much configuration requested %d+%d>%d" , offset, count, allowedSize);
271254 return true ;
272255 }
273- if (count > 65535 ) {
274- // this is TS protocol limitation
275- efiPrintf (" TS: requested more that can fit into one reply %d" , count);
276- return true ;
277- }
278256
279257 return false ;
280258}
@@ -479,7 +457,9 @@ void TunerStudio::handleScatteredReadCommand(TsChannelBase* tsChannel) {
479457void TunerStudio::handlePageReadCommand (TsChannelBase* tsChannel, uint32_t page, uint32_t offset, uint32_t count) {
480458 tsState.readPageCommandsCounter ++;
481459
482- if (validateOffsetCount (page, offset, count)) {
460+ // TS packet limit is 64K - 1 bytes
461+ if (validateOffsetCount (page, offset, count) ||
462+ (count > 65535 )) {
483463 tunerStudioError (tsChannel, " ERROR: RD out of range" );
484464 sendErrorCode (tsChannel, TS_RESPONSE_OUT_OF_RANGE );
485465 return ;
@@ -962,7 +942,7 @@ int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int inco
962942 handleCrc32Check (tsChannel, page, offset, count);
963943 break ;
964944 case TS_CRC32_CHECK_COMMAND :
965- {
945+ if (incomingPacketSize >= 13 ) {
966946 uint32_t page32 = data32[0 ];
967947 uint32_t offset32 = data32[1 ];
968948 uint32_t count32 = data32[2 ];
@@ -982,7 +962,7 @@ int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int inco
982962 handlePageReadCommand (tsChannel, page, offset, count);
983963 break ;
984964 case TS_READ32_COMMAND :
985- {
965+ if (incomingPacketSize >= 13 ) {
986966 uint32_t page32 = data32[0 ];
987967 uint32_t offset32 = data32[1 ];
988968 uint32_t count32 = data32[2 ];
0 commit comments