Skip to content

fixing bug in wcssstr#3549

Merged
chakrabot merged 1 commit into
chakra-core:masterfrom
mike-kaufman:build/mkaufman/fix-wcsstr-bug-gh-3434-rebased
Aug 21, 2017
Merged

fixing bug in wcssstr#3549
chakrabot merged 1 commit into
chakra-core:masterfrom
mike-kaufman:build/mkaufman/fix-wcsstr-bug-gh-3434-rebased

Conversation

@mike-kaufman

Copy link
Copy Markdown
Contributor

Fixing #3434.. Bug in wcsstr would return a match if the string being searched ended with a prefix of the search string. Fixed this to behave correctly. Also added tests to test_native.sh to verify this.

This is re-opened from PR #3542.

@msftclas

Copy link
Copy Markdown

@mike-kaufman,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

result += validate(PAL_wcsstr((const char16_t *)NULL, (const char16_t *)NULL), NULL, u"test7");
result += validate(PAL_wcsstr((const char16_t *)NULL, u""), NULL, u"test8");
result += validate(PAL_wcsstr(u"", (const char16_t *)NULL), NULL, u"test9");
result += validate(PAL_wcsstr(u"abcdefg", u""), u"abcdefg", u"test10");

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.

These are good- i would also add cases for "abcdefg", "abcdefg", "", "" and "", "def"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@digitalinfinity digitalinfinity 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.

:shipit:

@mike-kaufman mike-kaufman force-pushed the build/mkaufman/fix-wcsstr-bug-gh-3434-rebased branch 4 times, most recently from a870f6f to 561b04d Compare August 20, 2017 20:35
Comment thread pal/src/cruntime/wchar.cpp Outdated
if (*strCharSet == 0)
{
ret = (char16_t *)string;
if (*strCharSet == 0) {

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.

This looks like an unintentional change, the curly brace should start on the line after the if

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed...


build_type = sys.argv[1]
if sys.argv[2] != None:
if sys.argv.__len__() > 2 and sys.argv[2] != None:

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.

Is this change required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe so. I was getting failures when running the tests that used this about teh index being out of bounds. Adding this checked made that error go away.

Fixing chakra-core#3434.  Bug in wcsstr
would return a match if the string being searched ended with a prefix of the
search string. Also, fixing another bug with compat with win32 API.  If
search string is zero length, we should return the input string.  Added tests
to test_native.sh to verify behavior of wcsstr.
@mike-kaufman mike-kaufman force-pushed the build/mkaufman/fix-wcsstr-bug-gh-3434-rebased branch from 4e6b338 to 67b1cb4 Compare August 21, 2017 21:36
@chakrabot chakrabot merged commit 67b1cb4 into chakra-core:master Aug 21, 2017
chakrabot pushed a commit that referenced this pull request Aug 21, 2017
Merge pull request #3549 from mike-kaufman:build/mkaufman/fix-wcsstr-bug-gh-3434-rebased

Fixing #3434..  Bug in wcsstr would return a match if the string being searched ended with a prefix of the search string.  Fixed this to behave correctly.  Also added tests to test_native.sh to verify this.

This is re-opened from PR #3542.
@mike-kaufman mike-kaufman deleted the build/mkaufman/fix-wcsstr-bug-gh-3434-rebased branch March 16, 2018 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants