fix(brucegotchi): clamp setMood() bounds and expand mood variety#2556
Open
r13xr13 wants to merge 1 commit into
Open
fix(brucegotchi): clamp setMood() bounds and expand mood variety#2556r13xr13 wants to merge 1 commit into
r13xr13 wants to merge 1 commit into
Conversation
setMood() could index past number_of_moods causing an array overflow crash. Adds bounds clamp. Expands mood variety from 2 repeating moods to cycling through 5 active / 4 happy / 5 lonely moods for more organic pwnagotchi personality.
Ninja-jr
reviewed
Jun 26, 2026
Ninja-jr
left a comment
Contributor
There was a problem hiding this comment.
Was this tested on a real live device? If so and it works, it could be ok then
Author
|
Yes it has been tested on a few different devices by myself, and some others.
— Heavy Butter
Website : r13systems.xyz
Contact : ***@***.***
Sent from [Proton Mail](https://proton.me/mail/home) for iOS.
…-------- Original Message --------
On Friday, 06/26/26 at 07:55 Ninja-jr ***@***.***> wrote:
@Ninja-jr commented on this pull request.
Was this tested on a real live device? If so and it works, it could be ok then
—
Reply to this email directly, [view it on GitHub](#2556?email_source=notifications&email_token=BTRNDAWRJHRXVCWXFELGUYT5BZQC7A5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJXHEZDGMJSGIYKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-4579231220), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/BTRNDAVRIBNEA7H6XZNFLGT5BZQC7AVCNFSNUABFKJSXA33TNF2G64TZHM3TSNJRGY3DSNRRHNEXG43VMU5TINRZGA3TCNRTGI42C5QC).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Contributor
|
Ok then. Good. But it has merging conflicts that need sorted. |
Author
Yes I'm sure like I said check the repo I have to see the diffs Here |
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.
Summary
Two fixes for the Brucegotchi mood system:
setMood() out-of-bounds crash -- setMood() could index past
number_of_moodscausing an array overflow crash when mood indices exceed the defined array size. Adds a bounds clamp to cap atnumber_of_moods - 1.Mood variety expansion -- The Brucegotchi only cycled through 2 moods (one happy, one active) making the companion feel repetitive. Expanded to cycle through 5 active moods, 4 happy moods, and 5 lonely moods.
Changes
mood.cpp: Add bounds clamp insetMood()-- if mood index >= number_of_moods, clamp to number_of_moods - 1pwnagotchi.cpp: Replace 2-element mood arrays with full 5/4/5 arrays for active/happy/lonely statesmood.h,pwnagotchi.h,ui.h: Update array declarations to match new sizesTesting