Fix up of: IA2: Do not treat huge base64 data as NVDA might freeze in Google Chrome (PR #10231)#10281
Conversation
… Google Chrome (PR nvaccess#10231) Ensure to truncate base64 data only in the `src` attribute, and not in an eventual text content (eg. in and inline editor). Re: nvaccess#10231 (comment)
|
To be clear, this function never receives "text content". Rather, it
only receives well-formatted IAccessible2 attribute strings. I think the
confusion here is that we get attribute strings both from IAccessible2
objects, and from format runs of IAccessible2 text. But in both cases,
we are talking about name:value;name:value; strings, not random text
content.
Still, this pr does make the regex more specific, only applying to the
src attribute, which is a good thing.
|
|
If I am reading the regex correctly, it looks like the whole src:value part is totally removed. I don't think this is a good idea. I think code may want to know the src, and the fact that it contained base64. Really, we just want the bit after the comma (,) to be truncated. Apologies if I'm reading it incorrectly. |
Thanks for this clarification.
No problem, regex are always a challenge to read, and this one especially requires braille or total speech verbosity to be perceived correctly. On the contrary, my vbuf C++ proposals do not produce that same result as they also strip out the MIME type and produce results of the form "data:<truncated>". If you feel this is problematic, I'll update the proposed implementation so that the original MIME type is preserved. EDIT: Escaped the angle brackets for clarity. |
Link to issue number:
Fix up of PR #10231
Summary of the issue:
As mentioned by @michaelDCurran in #10231 (comment)
IAccessibleHandler.splitIA2Attribsmight also receive IAccessibleText as argument.Description of how this pull request fixes the issue:
Alter the regex as to ensure to truncate base64 data only in the
srcattribute, and not in an eventualtext content (eg. in and inline editor).
Testing performed:
Tested against the test case of #10227.
Known issues with pull request:
Change log entry:
Section: New features, Changes, Bug fixes