-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(developer): check correct use of u16chr when second parameter could be null #11894
test(developer): check correct use of u16chr when second parameter could be null #11894
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
I independently encountered the |
Merge branch 'fix/developer/11814-kmx_u16-buffer-overrun' into fix/developer/correct-use-of-u16chr-when-second-parameter-could-be-null
…e-of-u16chr-when-second-parameter-could-be-null # Keyman Conventional Commit suggestions: # # - Link to a Sentry issue with git trailer: # Fixes: _MODULE_-_ID_ # - Give credit to co-authors: # Co-authored-by: _Name_ <_email_> # - Use imperative, present tense ('attach' not 'attaches', 'attached' etc) # - Don't include a period at the end of the title # - Always include a blank line before trailers # - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
…g of context before test cases
…e-of-u16chr-when-second-parameter-could-be-null # Keyman Conventional Commit suggestions: # # - Link to a Sentry issue with git trailer: # Fixes: _MODULE_-_ID_ # - Give credit to co-authors: # Co-authored-by: _Name_ <_email_> # - Use imperative, present tense ('attach' not 'attaches', 'attached' etc) # - Don't include a period at the end of the title # - Always include a blank line before trailers # - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
… and remove unncessary prefix from two cases
…e-of-u16chr-when-second-parameter-could-be-null # Keyman Conventional Commit suggestions: # # - Link to a Sentry issue with git trailer: # Fixes: _MODULE_-_ID_ # - Give credit to co-authors: # Co-authored-by: _Name_ <_email_> # - Use imperative, present tense ('attach' not 'attaches', 'attached' etc) # - Don't include a period at the end of the title # - Always include a blank line before trailers # - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
Ready for review, although waiting for PR #11910 to be merged into master first. |
…e-of-u16chr-when-second-parameter-could-be-null # Keyman Conventional Commit suggestions: # # - Link to a Sentry issue with git trailer: # Fixes: _MODULE_-_ID_ # - Give credit to co-authors: # Co-authored-by: _Name_ <_email_> # - Use imperative, present tense ('attach' not 'attaches', 'attached' etc) # - Don't include a period at the end of the title # - Always include a blank line before trailers # - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
PR #11910 has been merged into master, and in turn into this PR, so it is ready to be reviewed. Compared to PR #11910, this PR offers more extensive testing of |
…e-of-u16chr-when-second-parameter-could-be-null
…e-of-u16chr-when-second-parameter-could-be-null # Keyman Conventional Commit suggestions: # # - Link to a Sentry issue with git trailer: # Fixes: _MODULE_-_ID_ # - Give credit to co-authors: # Co-authored-by: _Name_ <_email_> # - Use imperative, present tense ('attach' not 'attaches', 'attached' etc) # - Don't include a period at the end of the title # - Always include a blank line before trailers # - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, two small items -- one of which should probably be treated as a latent (if not currently visible) bug in the compiler?
Noting that the title and description suggest changes to the compiler code, not just the tests -- is there something missing?
// comment without following space | ||
u16cpy(str, u"c"); | ||
p = str; | ||
EXPECT_EQ(T_UNKNOWN, LineTokenType(&p)); | ||
EXPECT_EQ(0, p - str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I would have thought that this should be treated as a comment. It turns out that ReadLine()
strips the comment before it ever gets to LineTokenType()
, so we don't get failure:
keyman/developer/src/kmcmplib/src/Compiler.cpp
Lines 3404 to 3410 in bcec446
case L'c': | |
case L'C': | |
if ((p == str || iswspace(*(p - 1))) && iswspace(*(p + 1))) { | |
InComment = TRUE; | |
*p = L' '; | |
} | |
continue; |
(In ReadLine()
the input has a trailing \n
so iswspace(*(p+1))
is true.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left as is, except to add a comment to the test cf. ReadLine()
. Should I open an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, probably open an issue, add the low priority label to it.
This PR originally contained a fix to the compiler whilst in draft, but then you developed a fix in PR #11910. I merged that into this PR, adopting your fix and extending my tests (see my comments above). I will change the name of this PR to a reflect its final test-only content. |
…e-of-u16chr-when-second-parameter-could-be-null # Keyman Conventional Commit suggestions: # # - Link to a Sentry issue with git trailer: # Fixes: _MODULE_-_ID_ # - Give credit to co-authors: # Co-authored-by: _Name_ <_email_> # - Use imperative, present tense ('attach' not 'attaches', 'attached' etc) # - Don't include a period at the end of the title # - Always include a blank line before trailers # - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
…k_str_compare_to_strtok
…or 'c' with no following space
And ... I knew that and forgot. Sorry for the hassle! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes in this pull request will be available for download in Keyman version 18.0.80-alpha |
Fix the use of u16chr() with *q==0 in u16tok() bug (and anywhere else it is similarly misused) - see issue #11814
Tests for
u16chr()
andu16tok()
(both variants) are included ingtest-kmxu16-test.cpp
Partially fixes: #11814 (another PR is needed for the first bug)
Related-to: #11910
@keymanapp-test-bot skip