InfiniTimeOrg / InfiniTimeOrg/InfiniSim
SIGFPE (division by zero) in random number app
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 203
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
Enter the random number app.
Click the "generate random number" button, or one of the "+" or "-" buttons, a few times.
Most of the times, this will stop the simulator process with a SIGFPE due to a division by zero in InfiniTime/src/components/motion/MotionController.cpp, function MotionController::ShouldShakeWake, because time == lastTime
This looks like having time == lastTime could be a simulator bug, not an issue on actual hardware, not sure.
Here's the patch I have applied locally to InfiniTime; let me know if you think it should go to InfiniTime (cleaned up of debugging output to cerr, obviously) for better robustness or is just a work-around for a simulator bug.
(sorry I upload it as a ZIP file, github doesn't let me attach a patch file with a messaging listing the supported file types, among which "PATCH")
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash in the random number app, then inspect InfiniTime/src/components/motion/MotionController.cpp and MotionController::ShouldShakeWake, focusing on the time == lastTime case. Review the attached InfiniTime_FPE.zip patch and determine whether the guard belongs in InfiniTime or only works around a simulator issue. Done means repeated random-number generation no longer terminates the simulator with SIGFPE.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100