-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
[UIA] Prevent erroneous L'\0'
padding in GetText(INT_MAX)
#13779
Conversation
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.
cause of course
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.
L'\0'
padding in GetText(INT_MAX)
This comment was marked as resolved.
This comment was marked as resolved.
Decided to keep the |
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Apparently, calling `GetText(INT_MAX)` causes a HUGE memory spike for a few seconds each time this is called. The [UIA docs](https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-gettext#parameters) say to put `-1` if no limit is required, but I assume a few people have been hit by this before. This addresses this issue (and similar ones) in two ways: 1. as we iterate over the lines of text, if we're already past the max length, just break out of the loop 2. _only_ resize if the max length is actually less than the current length. This prevents us padding the string with `L'\0'` erroneously (which is probably what causes the memory spike). (cherry picked from commit b4ada09) Service-Card-Id: 85252534 Service-Version: 1.15
🎉 Handy links: |
🎉 Handy links: |
Apparently, calling
GetText(INT_MAX)
causes a HUGE memory spike for a few seconds each time this is called. The UIA docs say to put-1
if no limit is required, but I assume a few people have been hit by this before.This addresses this issue (and similar ones) in two ways:
L'\0'
erroneously (which is probably what causes the memory spike).