Release 0.3.0: fix Screen Dim label voice-prompt crash
The menu label 'Screen Dim' is a raw literal, and the shared menu code voices labels through voicePromptsAppendLanguageString(), which derives the prompt index from the pointer's offset within the language table and crashed on a foreign pointer (v0.2.0 fixed only the value, not the label). That helper now ignores pointers outside the language table. Bump version to 0.3.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1c59622a77
commit
dd1cc0ccdf
3 changed files with 19 additions and 2 deletions
|
|
@ -9,6 +9,14 @@ single running list until the first versioned release.
|
||||||
|
|
||||||
_Nothing yet._
|
_Nothing yet._
|
||||||
|
|
||||||
|
## 0.3.0
|
||||||
|
|
||||||
|
- **Fix a second voice-prompt crash** on the Screen Dim menu row: the item *label*
|
||||||
|
("Screen Dim") is a raw literal, and the shared menu code voices labels via
|
||||||
|
`voicePromptsAppendLanguageString()`, which crashes on any pointer outside the
|
||||||
|
language table. That function now ignores non-language pointers, so a stray
|
||||||
|
literal is skipped instead of hard-faulting. (The dim value is still announced.)
|
||||||
|
|
||||||
## 0.2.0
|
## 0.2.0
|
||||||
|
|
||||||
- **Fix crash** opening Display Options with **voice announcements on**: the Screen
|
- **Fix crash** opening Display Options with **voice announcements on**: the Screen
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
#define _FREETRX_VERSION_H_
|
#define _FREETRX_VERSION_H_
|
||||||
|
|
||||||
#define FREETRX_VERSION_MAJOR 0
|
#define FREETRX_VERSION_MAJOR 0
|
||||||
#define FREETRX_VERSION_MINOR 2
|
#define FREETRX_VERSION_MINOR 3
|
||||||
#define FREETRX_VERSION_PATCH 0
|
#define FREETRX_VERSION_PATCH 0
|
||||||
|
|
||||||
#define FREETRX_VERSION "0.2.0"
|
#define FREETRX_VERSION "0.3.0"
|
||||||
|
|
||||||
#endif // _FREETRX_VERSION_H_
|
#endif // _FREETRX_VERSION_H_
|
||||||
|
|
|
||||||
|
|
@ -343,6 +343,15 @@ void voicePromptsAppendLanguageString(const char *languageStringAdd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The prompt index is derived from the pointer's offset within the currentLanguage
|
||||||
|
// table, so a pointer that isn't actually inside that table (e.g. a raw string
|
||||||
|
// literal passed by mistake) would yield an out-of-range prompt and crash. Ignore it.
|
||||||
|
const char *languageBase = ¤tLanguage->LANGUAGE_NAME[0];
|
||||||
|
if ((languageStringAdd < languageBase) || (languageStringAdd >= (languageBase + sizeof(*currentLanguage))))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
voicePromptsAppendPrompt(NUM_VOICE_PROMPTS +
|
voicePromptsAppendPrompt(NUM_VOICE_PROMPTS +
|
||||||
((languageStringAdd - currentLanguage->LANGUAGE_NAME)
|
((languageStringAdd - currentLanguage->LANGUAGE_NAME)
|
||||||
#if ! defined(HAS_COLOURS)
|
#if ! defined(HAS_COLOURS)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue