Repository navigation
Ignore out-of-range days and hours in price modifiers - #1329
Merged
Merged
Conversation
/save set price modifier day and hour bits straight from the form values, so day 7 or hour 24 to 31 set bits outside the week and the day (and 32 or more shifted past the width of the int). The configuration file export then wrote one byte past the end of its days[21] or hours[72] buffer, because a full set of entries plus the terminator needs one more byte. - Only accept days 0-6 and hours 0-23 when saving. - Size both export buffers for the terminator. Co-Authored-By: Claude Opus 5.5 <[email protected]>
🔧 PR Build ArtifactsVersion: All environments built successfully. Download the zip files:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
/savebuilds the price modifier day and hour masks straight from the form values (pc.days |= 1 << day,pc.hours |= 1 << hour) without checking the range. This causes two problems:int, which is undefined behaviour.0x7F) or "all hours" (0xFFFFFF) shortcut no longer applies. The configuration file export then writes all 7 days or all 24 hours. That is 21 or 72 characters plus the terminator, which is one byte past the end ofdays[3*7]orhours[3*24]on the stack.Changes
Verification
pio runfor esp8266dev, esp32dev and esp32s2dev.🤖 Generated with Claude Code