Skip to content

fix(developer): handle leading delimiters correctly in u16tok() - #16446

Merged
mcdurdin merged 2 commits into
masterfrom
fix/developer/13721-u16tok-targets-store-leading-whitespace
Sep 1, 2026
Merged

fix(developer): handle leading delimiters correctly in u16tok()#16446
mcdurdin merged 2 commits into
masterfrom
fix/developer/13721-u16tok-targets-store-leading-whitespace

Conversation

@mcdurdin

Copy link
Copy Markdown
Member

A string with leading delimiters passed into u16tok() would not skip those delimiters. This impacted &targets store and other locations.

Note that this tightens input parameter checks for delimiters and context as well.

Fixes: #13721
Test-bot: skip

@keymanapp-test-bot

keymanapp-test-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

  • Developer
    • Keyman Developer - build : all tests passed (no artifacts on BuildLevel "build")
    • Compiler Regression Tests - build : all tests passed (no artifacts on BuildLevel "build")
    • kmcomp.zip - build : all tests passed (no artifacts on BuildLevel "build")
  • Keyboards
    • Test Keyboards - build : all tests passed (no artifacts on BuildLevel "build")
  • Windows
    • Keyman for Windows - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Windows - build : all tests passed (no artifacts on BuildLevel "build")
    • Text Editor (ARM64) - build : all tests passed (no artifacts on BuildLevel "build")
    • Text Editor (x64) - build : all tests passed (no artifacts on BuildLevel "build")
    • Text Editor (x86) - build : all tests passed (no artifacts on BuildLevel "build")

@github-actions github-actions Bot added the fix label Aug 27, 2026
@mcdurdin
mcdurdin requested a review from ermshiperete August 27, 2026 09:06
@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S36 milestone Aug 27, 2026
@mcdurdin
mcdurdin marked this pull request as draft August 27, 2026 09:10
A string with leading delimiters passed into `u16tok()` would not skip
those delimiters. This impacted `&targets` store and other locations.

Note that this tightens input parameter checks for delimiters and
context as well.

Fixes: #13721
Test-bot: skip
@mcdurdin
mcdurdin force-pushed the fix/developer/13721-u16tok-targets-store-leading-whitespace branch from 86b58d5 to babb473 Compare August 27, 2026 09:15
@mcdurdin
mcdurdin marked this pull request as ready for review August 27, 2026 10:11
@mcdurdin mcdurdin changed the title fix(developer): handle leading whitespace correctly in u16tok() fix(developer): handle leading delimiters correctly in u16tok() Aug 28, 2026

@SabineSIL SabineSIL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for a parameter name in function description

Comment on lines +1338 to +1343
* same length or shorter.
* @param sp store value to rewrite
* @param targets (output)
* @return FALSE if no targets found or invalid targets found
*/
KMX_BOOL GetCompileTargetsFromTargetsStore(KMX_WCHAR *store, int &targets) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param store instead of param sp?

const result = await compileTestKeyboard(callbacks, ['keyboards', 'targets-with-whitespace.kmn']);
assert.isNotNull(result);

// Verifies that targets has 'any' as it contains both JS and KMX targets

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find having this comment here a bit confusing since the next block of lines doesn't deal neither with targets nor with any. Would it make more sense to put it before line 155 (const reader = new KmxFileReader();)?

Comment thread developer/src/kmcmplib/src/Compiler.cpp
Comment thread developer/src/kmcmplib/tests/gtest-km_u16.tests.cpp
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
Co-authored-by: Sabine Schmitt <SabineSIL@users.noreply.github.com>
@keyman-server keyman-server modified the milestones: A19S36, B19S1 Aug 30, 2026
@mcdurdin
mcdurdin merged commit 1e8cd24 into master Sep 1, 2026
13 checks passed
@mcdurdin
mcdurdin deleted the fix/developer/13721-u16tok-targets-store-leading-whitespace branch September 1, 2026 05:27
@github-project-automation github-project-automation Bot moved this from Todo to Done in Keyman Sep 1, 2026
@keyman-server

Copy link
Copy Markdown
Collaborator

Changes in this pull request will be available for download in Keyman version 19.0.277-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(developer): &TARGETS store is too sensitive to whitespace 🤔

4 participants