We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iotkit-embedded/src/services/linkkit/dm/dm_fota.c 这个文件中的66行有一个bug。
int res = 0, file_download = 0; uint32_t file_size = 0, file_downloaded = 0; uint32_t percent_pre = 0, percent_now = 0; unsigned long long report_pre = 0, report_now = 0; dm_fota_ctx_t *ctx = _dm_fota_get_ctx();
file_downloaded及file_size的大小默认是unit32_t类型,这个类型的最大值为4294967295 也就是文件可以最大4个G,这对于固件应该不是问题,但往下看。
/* Get OTA information */ IOT_OTA_Ioctl(ota_handle, IOT_OTAG_FETCHED_SIZE, &file_downloaded, 4); IOT_OTA_Ioctl(ota_handle, IOT_OTAG_FILE_SIZE, &file_size, 4); /* Calculate Download Percent And Update Report Timestamp*/ percent_now = (file_downloaded * 100) / file_size; report_now = HAL_UptimeMs(); /* Report Download Process To Cloud */ if (report_now < report_pre) { report_pre = report_now; }
percent_now = (file_downloaded * 100) / file_size; 因为这里面乘以100,如果固件大于42M,造成数据溢出。就会造成更新进度异常。 所以只需要改一下 uint32_t file_size = 0, file_downloaded = 0; 为 uint64_t file_size = 0, file_downloaded = 0;
The text was updated successfully, but these errors were encountered:
感谢您对反馈 我们已经将您的建议反馈给研发的同学
Sorry, something went wrong.
No branches or pull requests
iotkit-embedded/src/services/linkkit/dm/dm_fota.c 这个文件中的66行有一个bug。
file_downloaded及file_size的大小默认是unit32_t类型,这个类型的最大值为4294967295
也就是文件可以最大4个G,这对于固件应该不是问题,但往下看。
percent_now = (file_downloaded * 100) / file_size;
因为这里面乘以100,如果固件大于42M,造成数据溢出。就会造成更新进度异常。
所以只需要改一下
uint32_t file_size = 0, file_downloaded = 0;
为
uint64_t file_size = 0, file_downloaded = 0;
The text was updated successfully, but these errors were encountered: