New issue
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
NegativeArraySizeException crash in SecureDfuImpl.java #229
Comments
I'll look into this issue. |
Here's what happens: Android-DFU-Library/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java Lines 630 to 646 in cb39f55
The lib crashes in line 640, reporting byte array size -16117760. This is equal to info.maxSize - bytesLost , where info.maxSize is 4096 bytes. That means, that the lib calculated bytesLost as 4096 + 16117760 = 16121856 which is wrong, as this is around 16 MB.
Do you have any logs from before the error happens? How did it go that far? |
For now I'll reopen the PR above, which does not fix this issue, but at least reports this error other way than by crashing the app. |
Thanks to #247 I have fixed the crash, but the root cause is still unknown. I'll release it in 1.10.4 now. |
I'm closing the issue. If you find the same issue in 1.10.4 or newer, please reopen. |
这个错误主要是在恢复DFU时,传输Object数据的时候,一次传输超过了 ObjectSize 大小,导致info.maxSize - bytesLost 变成了负数。 现在算是彻底解决了问题: NordicSemiconductor#229
@philips77 Use the DFU library 2.3.0 in an application. When the firmware is updating, the user insert wired headset。Which cause dfu failed. // Device Firmware Upgrade 05-25 14:38:37.796 3864 3864 D FirmwareUpgrader::dfuLogListener$lambda-0[85] [5][DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-03-01-8D-00-00-00-4D-75-7B-C9 |
Information
DFU Bootloader version (please complete the following information):
Device information (please complete the following information):
Describe the bug
Ran into a negative array size exception crash while performing a series of DFU operations, one after the other. This doesn't happen all the time, but we run into it a few times while upgrading hundreds of devices
Some background:
I am using the DFU library in an application that upgrades a series of nRF52832 based devices. The app picks one badge at a time, moves it into DFU mode and then starts a DFU operation. The mechanism for moving the badge to DFU mode is proprietary and doesn't use the standard buttonless service. The app does not establish its own GATT connection before handing off to the DFU operation.
Logs
The text was updated successfully, but these errors were encountered: