aws / ota-for-aws-iot-embedded-sdk

MIT License
60 stars 74 forks source link

[BUG] Memory corruption if OTA_MAX_BLOCK_BITMAP_SIZE is too small for the file #476

Closed gregbreen closed 1 year ago

gregbreen commented 1 year ago

Describe the bug As per issue on re:Post: https://repost.aws/questions/QU4tQPeyESRUqKmMXC__TcYw/large-mqtt-ota-file-transfer-fails-at-block-1024

The customer appeared to suffer a memory corruption when OTA_MAX_BLOCK_BITMAP_SIZE was too small for their file size. Problem was resolved when OTA_MAX_BLOCK_BITMAP_SIZE was set to sufficient size.

Host ESP32 with FreeRTOS.

To Reproduce Do an OTA with OTA_MAX_BLOCK_BITMAP_SIZE set too small for your file size.

Expected behavior OTA library should check the file size before beginning the file transfer, and fail gracefully if the file is too big. No memory corruption should occur.

Additional context I haven't personally taken the time to reproduce the problem. From perusing the code, I couldn't see the library protecting itself in this situation. Discussed the problem with Soren before raising this issue.