From fed67399d2f83bb02dbe1b9c0681d5c459babe82 Mon Sep 17 00:00:00 2001 From: rusefi Date: Wed, 3 May 2017 18:08:04 -0400 Subject: [PATCH] better state validation --- README.md | 1 + firmware/controllers/trigger/trigger_structure.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 036f88fd58..32327d5b6a 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ current binaries are always available at http://rusefi.com/build_server/ | Release date | Revision | Details | | ------------ | --------- | ------- | +| 05/03/2017 | r13967 | improvement: ChibiOS 3.2 | | 04/06/2017 | r13759 | major improvement #72: ChibiOS 3.1 | | 03/26/2017 | r13330 | super annoying bug #336 fixed | | 03/20/2017 | r13233 | improvements #375 & #376: hard FPU mode & migrating to fresh version of arm gcc | diff --git a/firmware/controllers/trigger/trigger_structure.cpp b/firmware/controllers/trigger/trigger_structure.cpp index fc28b49e67..952915ae06 100644 --- a/firmware/controllers/trigger/trigger_structure.cpp +++ b/firmware/controllers/trigger/trigger_structure.cpp @@ -53,6 +53,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE engine->engineCycleEventCount = getLength(); float firstAngle = getAngle(triggerShapeSynchPointIndex); + assertAngleRange(triggerShapeSynchPointIndex, "firstAngle"); int frontOnlyIndex = 0; @@ -64,6 +65,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE eventAngles[1] = 0; frontOnlyIndexes[0] = 0; } else { + assertAngleRange(triggerShapeSynchPointIndex, "triggerShapeSynchPointIndex"); int triggerDefinitionCoordinate = (triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount; efiAssertVoid(engine->engineCycleEventCount != 0, "zero engineCycleEventCount"); int triggerDefinitionIndex = triggerDefinitionCoordinate >= size ? triggerDefinitionCoordinate - size : triggerDefinitionCoordinate;