We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd9ec48 commit 198e79dCopy full SHA for 198e79d
src/jswrap_flash.c
@@ -374,7 +374,12 @@ void jsfLoadFromFlash() {
374
uint32_t cbData[2];
375
jshFlashRead(&cbData[0], FLASH_SAVED_CODE_START, 4); // end address
376
cbData[1] = FLASH_SAVED_CODE_START+4; // start address
377
- jsiConsolePrintf("Loading %d bytes from flash...\n", cbData[0]-FLASH_SAVED_CODE_START);
+ uint32_t len = cbData[0]-FLASH_SAVED_CODE_START;
378
+ if (len>1000000) {
379
+ jsiConsolePrintf("Invalid saved code in flash!\n");
380
+ return;
381
+ }
382
+ jsiConsolePrintf("Loading %d bytes from flash...\n", len);
383
DECOMPRESS(jsfLoadFromFlash_readcb, cbData, (unsigned char*)basePtr);
384
#endif
385
}
0 commit comments