Fix various crashes if debug libraries used (#3144)

* FuriHal: enable HSI in stop mode only if we use STOP0, proper SMPS selected clock assert

* Furi: fix double crash caused by bkpt use outside of debug session

* Libs: update ERC and MGG contrast

* Fix various crashes with LIB_DEBUG=1

* BadUsb: size_t where it should be and proper printf types

* Various fixes and make PVS happy

* FuriHal: proper CCID status and make PVS happy

* boot: update mode: graceful handling of corrupted stage file

---------

Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
あく
2023-10-12 20:34:30 +04:00
committed by GitHub
co-authored by hedger
parent 38792f2c93
commit f45a5dff43
17 changed files with 47 additions and 42 deletions
+3 -2
View File
@@ -70,7 +70,8 @@ static bool flipper_update_load_stage(const FuriString* work_dir, UpdateManifest
if((f_stat(furi_string_get_cstr(loader_img_path), &stat) != FR_OK) ||
(f_open(&file, furi_string_get_cstr(loader_img_path), FA_OPEN_EXISTING | FA_READ) !=
FR_OK)) {
FR_OK) ||
(stat.fsize == 0)) {
furi_string_free(loader_img_path);
return false;
}
@@ -83,7 +84,7 @@ static bool flipper_update_load_stage(const FuriString* work_dir, UpdateManifest
uint32_t crc = 0;
do {
uint16_t size_read = 0;
if(f_read(&file, img + bytes_read, MAX_READ, &size_read) != FR_OK) {
if(f_read(&file, img + bytes_read, MAX_READ, &size_read) != FR_OK) { //-V769
break;
}
crc = crc32_calc_buffer(crc, img + bytes_read, size_read);